SQLite

Check-in [698b2a2800]
Login

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

Overview
Comment:Make sure the WHERE_IDX_ONLY flag is not set on query plans that will not be using an index.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | fullscan-covering-index
Files: files | file ages | folders
SHA1: 698b2a28004a9a2f0eabaadf36d833da4400b2bf
User & Date: drh 2012-09-17 21:24:01.339
Context
2012-09-19
00:35
Merge the covering-index-scan optimization into trunk. (check-in: ddd5d789e7 user: drh tags: trunk)
2012-09-17
21:24
Make sure the WHERE_IDX_ONLY flag is not set on query plans that will not be using an index. (Closed-Leaf check-in: 698b2a2800 user: drh tags: fullscan-covering-index)
20:44
Add the ability to disable the covering-index-scan optimization at compile-time, start-time, or at run-time. Add test cases to check this configurability. (check-in: ccb8ecc30c user: drh tags: fullscan-covering-index)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
3219
3220
3221
3222
3223
3224
3225

3226
3227
3228
3229
3230
3231
3232
      ** We add an additional 4x penalty to full table scans.  This causes
      ** the cost function to err on the side of choosing an index over
      ** choosing a full scan.  This 4x full-scan penalty is an arguable
      ** decision and one which we expect to revisit in the future.  But
      ** it seems to be working well enough at the moment.
      */
      cost = aiRowEst[0]*4;

    }else{
      log10N = estLog(aiRowEst[0]);
      cost = nRow;
      if( pIdx ){
        if( bLookup ){
          /* For an index lookup followed by a table lookup:
          **    nInMul index searches to find the start of each index range







>







3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
      ** We add an additional 4x penalty to full table scans.  This causes
      ** the cost function to err on the side of choosing an index over
      ** choosing a full scan.  This 4x full-scan penalty is an arguable
      ** decision and one which we expect to revisit in the future.  But
      ** it seems to be working well enough at the moment.
      */
      cost = aiRowEst[0]*4;
      wsFlags &= ~WHERE_IDX_ONLY;
    }else{
      log10N = estLog(aiRowEst[0]);
      cost = nRow;
      if( pIdx ){
        if( bLookup ){
          /* For an index lookup followed by a table lookup:
          **    nInMul index searches to find the start of each index range