/ Check-in [16c22ff8]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Show symbolic SELECT names in EXPLAIN QUERY PLAN output when compiling with SQLITE_ENABLE_SELECTTRACE.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | EQP-improvements
Files: files | file ages | folders
SHA3-256: 16c22ff8189c2beaf03f3fcab2434bbd9d2d9960b54598dc62489d829568f669
User & Date: drh 2018-03-19 16:59:22
Context
2018-03-19
16:59
Show symbolic SELECT names in EXPLAIN QUERY PLAN output when compiling with SQLITE_ENABLE_SELECTTRACE. Leaf check-in: 16c22ff8 user: drh tags: EQP-improvements
16:09
In the compile_options pragma, show the actual value of the SQLITE_ENABLE_CEROD compile-time option, if it exists. check-in: 1ec339fd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/expr.c.

2609
2610
2611
2612
2613
2614
2615






2616
2617
2618
2619
2620
2621
2622
#ifndef SQLITE_OMIT_EXPLAIN
  if( pParse->explain==2 ){
    char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
        jmpIfDynamic>=0?"":"CORRELATED ",
        pExpr->op==TK_IN?"LIST":"SCALAR",
        pParse->iNextSelectId
    );






    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
  }
#endif

  switch( pExpr->op ){
    case TK_IN: {
      int addr;                   /* Address of OP_OpenEphemeral instruction */







>
>
>
>
>
>







2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
#ifndef SQLITE_OMIT_EXPLAIN
  if( pParse->explain==2 ){
    char *zMsg = sqlite3MPrintf(pParse->db, "EXECUTE %s%s SUBQUERY %d",
        jmpIfDynamic>=0?"":"CORRELATED ",
        pExpr->op==TK_IN?"LIST":"SCALAR",
        pParse->iNextSelectId
    );
#if SELECTTRACE_ENABLED
    if( ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pSelect!=0 ){
       zMsg = sqlite3MPrintf(pParse->db, "%z (%s)", zMsg,
                             pExpr->x.pSelect->zSelName);
    }
#endif
    sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC);
  }
#endif

  switch( pExpr->op ){
    case TK_IN: {
      int addr;                   /* Address of OP_OpenEphemeral instruction */

Changes to src/wherecode.c.

149
150
151
152
153
154
155




156

157
158
159
160
161
162
163
    isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
            || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
            || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));

    sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);
    sqlite3StrAccumAppendAll(&str, isSearch ? "SEARCH" : "SCAN");
    if( pItem->pSelect ){




      sqlite3XPrintf(&str, " SUBQUERY %d", pItem->iSelectId);

    }else{
      sqlite3XPrintf(&str, " TABLE %s", pItem->zName);
    }

    if( pItem->zAlias ){
      sqlite3XPrintf(&str, " AS %s", pItem->zAlias);
    }







>
>
>
>

>







149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
    isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0
            || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0))
            || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX));

    sqlite3StrAccumInit(&str, db, zBuf, sizeof(zBuf), SQLITE_MAX_LENGTH);
    sqlite3StrAccumAppendAll(&str, isSearch ? "SEARCH" : "SCAN");
    if( pItem->pSelect ){
#if SELECTTRACE_ENABLED
      sqlite3XPrintf(&str, " SUBQUERY %d (%s)",
                     pItem->iSelectId, pItem->pSelect->zSelName);
#else
      sqlite3XPrintf(&str, " SUBQUERY %d", pItem->iSelectId);
#endif
    }else{
      sqlite3XPrintf(&str, " TABLE %s", pItem->zName);
    }

    if( pItem->zAlias ){
      sqlite3XPrintf(&str, " AS %s", pItem->zAlias);
    }