/ Check-in [71d488b5]
Login

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

Overview
Comment:Identify indexes that completely cover their table.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | covering-index
Files: files | file ages | folders
SHA1: 71d488b599cbde817de369efac4412569a55b43d
User & Date: drh 2016-02-24 15:43:05
Original Comment: Identify indexes that complete cover their table.
Context
2016-02-24
17:18
When an index completely covers a table, it can be used as a covering index even if columns past the 63rd column are indexed and accessed. check-in: 3e9ed1ae user: drh tags: trunk
15:43
Identify indexes that completely cover their table. Closed-Leaf check-in: 71d488b5 user: drh tags: covering-index
2016-02-23
16:28
Add the SQLITE_BITMASK_TYPE compile-time option. check-in: 0064a8c7 user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/build.c.

3188
3189
3190
3191
3192
3193
3194











3195
3196
3197
3198
3199
3200
3201
        i++;
      }
    }
    assert( i==pIndex->nColumn );
  }else{
    pIndex->aiColumn[i] = XN_ROWID;
    pIndex->azColl[i] = sqlite3StrBINARY;











  }
  sqlite3DefaultRowEst(pIndex);
  if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);

  if( pTab==pParse->pNewTable ){
    /* This routine has been called to create an automatic index as a
    ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or







>
>
>
>
>
>
>
>
>
>
>







3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
        i++;
      }
    }
    assert( i==pIndex->nColumn );
  }else{
    pIndex->aiColumn[i] = XN_ROWID;
    pIndex->azColl[i] = sqlite3StrBINARY;
    /* If this index contains every column of its table, then mark
    ** it as a covering index */
    if( pTblName!=0 && pIndex->nColumn>=pTab->nCol ){
      pIndex->isCovering = 1;
      for(j=0; j<pTab->nCol; j++){
        if( j==pTab->iPKey ) continue;
        if( sqlite3ColumnOfIndex(pIndex,j)>=0 ) continue;
        pIndex->isCovering = 0;
        break;
      }
    }
  }
  sqlite3DefaultRowEst(pIndex);
  if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);

  if( pTab==pParse->pNewTable ){
    /* This routine has been called to create an automatic index as a
    ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or