Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Move field WhereLevel.pCovidx inside the union to WhereLevel.u.pCovidx. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | multi-or-covering-index |
Files: | files | file ages | folders |
SHA1: |
b722143d075979ba3d92b7b29e576ce2 |
User & Date: | drh 2012-08-24 23:24:15.128 |
Context
2012-08-24
| ||
23:56 | When the same index is used for all OR-terms in a WHERE clause, then try to use that index as a covering index. (check-in: 62678be3df user: drh tags: trunk) | |
23:24 | Move field WhereLevel.pCovidx inside the union to WhereLevel.u.pCovidx. (Closed-Leaf check-in: b722143d07 user: drh tags: multi-or-covering-index) | |
21:54 | Remove a NEVER() that is in fact reachable on an OOM. This probably has nothing to do with the multi-or-covering-index change but just happened to be found while testing that change. (check-in: 5499af53eb user: drh tags: multi-or-covering-index) | |
Changes
Changes to src/sqliteInt.h.
︙ | ︙ | |||
1943 1944 1945 1946 1947 1948 1949 1950 | struct { int nIn; /* Number of entries in aInLoop[] */ struct InLoop { int iCur; /* The VDBE cursor used by this IN operator */ int addrInTop; /* Top of the IN loop */ } *aInLoop; /* Information about each nested IN operator */ } in; /* Used when plan.wsFlags&WHERE_IN_ABLE */ } u; | > < | 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 | struct { int nIn; /* Number of entries in aInLoop[] */ struct InLoop { int iCur; /* The VDBE cursor used by this IN operator */ int addrInTop; /* Top of the IN loop */ } *aInLoop; /* Information about each nested IN operator */ } in; /* Used when plan.wsFlags&WHERE_IN_ABLE */ Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */ } u; /* The following field is really not part of the current level. But ** we need a place to cache virtual table index information for each ** virtual table in the FROM clause and the WhereLevel structure is ** a convenient place since there is one WhereLevel for each FROM clause ** element. */ |
︙ | ︙ |
Changes to src/where.c.
︙ | ︙ | |||
4442 4443 4444 4445 4446 4447 4448 | } /* Finish the loop through table entries that match term pOrTerm. */ sqlite3WhereEnd(pSubWInfo); } } } | | | 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 | } /* Finish the loop through table entries that match term pOrTerm. */ sqlite3WhereEnd(pSubWInfo); } } } pLevel->u.pCovidx = pCov; pLevel->iIdxCur = iCovCur; if( pAndExpr ){ pAndExpr->pLeft = 0; sqlite3ExprDelete(pParse->db, pAndExpr); } sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); |
︙ | ︙ | |||
5273 5274 5275 5276 5277 5278 5279 | ** directly. This loop scans all that code looking for opcodes ** that reference the table and converts them into opcodes that ** reference the index. */ if( pLevel->plan.wsFlags & WHERE_INDEXED ){ pIdx = pLevel->plan.u.pIdx; }else if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){ | | | 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 | ** directly. This loop scans all that code looking for opcodes ** that reference the table and converts them into opcodes that ** reference the index. */ if( pLevel->plan.wsFlags & WHERE_INDEXED ){ pIdx = pLevel->plan.u.pIdx; }else if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){ pIdx = pLevel->u.pCovidx; } if( pIdx && !db->mallocFailed){ int k, j, last; VdbeOp *pOp; pOp = sqlite3VdbeGetOp(v, pWInfo->iTop); last = sqlite3VdbeCurrentAddr(v); |
︙ | ︙ |