diff options
author | dan <dan@noemail.net> | 2010-11-13 16:42:27 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-11-13 16:42:27 +0000 |
commit | 4bc39fa1886665f4496fbd98c3a439729d7de1f8 (patch) | |
tree | 2e5bb26f2a19c66533da97cf43b1e51aafbea978 /src | |
parent | fa00aa2ea1cccb27eeaaf1f445bc8a6fbf64876c (diff) | |
download | sqlite-4bc39fa1886665f4496fbd98c3a439729d7de1f8.tar.gz sqlite-4bc39fa1886665f4496fbd98c3a439729d7de1f8.zip |
Change the EXPLAIN QUERY PLAN output to use "USING INDEX" instead of "BY INDEX", and to use "SEARCH" instead of "SCAN" for loops that are not full-table scans.
FossilOrigin-Name: 6611b76b0296875fb9903b25dfaa783a9c12eaa1
Diffstat (limited to 'src')
-rw-r--r-- | src/where.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/where.c b/src/where.c index 1c1f7bbcb..7c7eae17f 100644 --- a/src/where.c +++ b/src/where.c @@ -3221,13 +3221,17 @@ static void explainOneScan( char *zMsg; /* Text to add to EQP output */ sqlite3_int64 nRow; /* Expected number of rows visited by scan */ int iId = pParse->iSelectId; /* Select id (left-most output column) */ + int isSearch; /* True for a SEARCH. False for SCAN. */ if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return; + isSearch = (pLevel->plan.nEq>0 || flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT)); + + zMsg = sqlite3MPrintf(db, "%s", isSearch?"SEARCH":"SCAN"); if( pItem->pSelect ){ - zMsg = sqlite3MPrintf(db, "SCAN SUBQUERY %d", pItem->iSelectId); + zMsg = sqlite3MAppendf(db, zMsg, "%s SUBQUERY %d", zMsg,pItem->iSelectId); }else{ - zMsg = sqlite3MPrintf(db, "SCAN TABLE %s", pItem->zName); + zMsg = sqlite3MAppendf(db, zMsg, "%s TABLE %s", zMsg, pItem->zName); } if( pItem->zAlias ){ @@ -3235,7 +3239,7 @@ static void explainOneScan( } if( (flags & WHERE_INDEXED)!=0 ){ char *zWhere = explainIndexRange(db, pLevel, pItem->pTab); - zMsg = sqlite3MAppendf(db, zMsg, "%s BY %s%sINDEX%s%s%s", zMsg, + zMsg = sqlite3MAppendf(db, zMsg, "%s USING %s%sINDEX%s%s%s", zMsg, ((flags & WHERE_TEMP_INDEX)?"AUTOMATIC ":""), ((flags & WHERE_IDX_ONLY)?"COVERING ":""), ((flags & WHERE_TEMP_INDEX)?"":" "), @@ -3244,7 +3248,7 @@ static void explainOneScan( ); sqlite3DbFree(db, zWhere); }else if( flags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s BY INTEGER PRIMARY KEY", zMsg); + zMsg = sqlite3MAppendf(db, zMsg, "%s USING INTEGER PRIMARY KEY", zMsg); if( flags&WHERE_ROWID_EQ ){ zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid=?)", zMsg); |