mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Make sure that disabling the covering index scan optimization does not
prevent a covering index from being used to satisfy an ORDER BY clause. FossilOrigin-Name: e8b7ea8202c443bfc8a978588c7d2cfaa14a8fea
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Restore\sthe\sability\sto\sdo\sa\sBETWEEN\squery\son\sthe\srowid.\s\sAlso\sfix\sa\nnearby\scomment.
|
C Make\ssure\sthat\sdisabling\sthe\scovering\sindex\sscan\soptimization\sdoes\snot\nprevent\sa\scovering\sindex\sfrom\sbeing\sused\sto\ssatisfy\san\sORDER\sBY\sclause.
|
||||||
D 2013-06-13T15:50:59.429
|
D 2013-06-13T17:28:22.026
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
|
F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -289,7 +289,7 @@ F src/vtab.c b05e5f1f4902461ba9f5fc49bb7eb7c3a0741a83
|
|||||||
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
|
F src/wal.c 436bfceb141b9423c45119e68e444358ee0ed35d
|
||||||
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
F src/wal.h df01efe09c5cb8c8e391ff1715cca294f89668a4
|
||||||
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
F src/walker.c 4fa43583d0a84b48f93b1e88f11adf2065be4e73
|
||||||
F src/where.c 82b519b79e4efc45461f6ce3990292c01b5adfdd
|
F src/where.c 700085a8d8e0edf13db11e110577320ec7348edc
|
||||||
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2
|
||||||
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
F test/aggerror.test a867e273ef9e3d7919f03ef4f0e8c0d2767944f2
|
||||||
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
F test/aggnested.test 45c0201e28045ad38a530b5a144b73cd4aa2cfd6
|
||||||
@@ -1095,7 +1095,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
|||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
|
F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P 3a72af2a95b04b8e195ef17cb3e9d9021a4f0915
|
P 459a7b9068310b36fed950940d251c4b798ffc58
|
||||||
R 1257e951bd26adefbb24e4a4d17e2b37
|
R 242dd2338fa025aa7191faa8afaf3ae6
|
||||||
U drh
|
U drh
|
||||||
Z e1ac17bd2fbb6e506f40edf419e837ee
|
Z 7fc4ebaffcaa0d84212cec77e769d428
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
459a7b9068310b36fed950940d251c4b798ffc58
|
e8b7ea8202c443bfc8a978588c7d2cfaa14a8fea
|
||||||
19
src/where.c
19
src/where.c
@@ -445,7 +445,6 @@ struct WhereInfo {
|
|||||||
#define WHERE_ONEROW 0x00001000 /* Selects no more than one row */
|
#define WHERE_ONEROW 0x00001000 /* Selects no more than one row */
|
||||||
#define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */
|
#define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */
|
||||||
#define WHERE_TEMP_INDEX 0x00004000 /* Uses an ephemeral index */
|
#define WHERE_TEMP_INDEX 0x00004000 /* Uses an ephemeral index */
|
||||||
#define WHERE_COVER_SCAN 0x00008000 /* Full scan of a covering index */
|
|
||||||
|
|
||||||
|
|
||||||
/* Convert a WhereCost value (10 times log2(X)) into its integer value X.
|
/* Convert a WhereCost value (10 times log2(X)) into its integer value X.
|
||||||
@@ -3614,8 +3613,7 @@ static Bitmask codeOneLoopStart(
|
|||||||
pLevel->op = OP_Next;
|
pLevel->op = OP_Next;
|
||||||
}
|
}
|
||||||
pLevel->p1 = iIdxCur;
|
pLevel->p1 = iIdxCur;
|
||||||
if( (pLoop->wsFlags & (WHERE_COLUMN_EQ | WHERE_COLUMN_RANGE |
|
if( (pLoop->wsFlags & WHERE_CONSTRAINT)==0 ){
|
||||||
WHERE_COLUMN_NULL | WHERE_COLUMN_IN))==0 ){
|
|
||||||
pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
|
pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP;
|
||||||
}else{
|
}else{
|
||||||
assert( pLevel->p5==0 );
|
assert( pLevel->p5==0 );
|
||||||
@@ -4375,6 +4373,7 @@ static int indexMightHelpWithOrderBy(
|
|||||||
int iCol;
|
int iCol;
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
|
if( pIndex->bUnordered ) return 0;
|
||||||
if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0;
|
if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0;
|
||||||
iCol = pIndex->aiColumn[0];
|
iCol = pIndex->aiColumn[0];
|
||||||
for(ii=0; ii<pOB->nExpr; ii++){
|
for(ii=0; ii<pOB->nExpr; ii++){
|
||||||
@@ -4503,6 +4502,8 @@ static int whereLoopAddBtree(
|
|||||||
pNew->prereq = mExtra;
|
pNew->prereq = mExtra;
|
||||||
pNew->u.btree.pIndex = pProbe;
|
pNew->u.btree.pIndex = pProbe;
|
||||||
b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
|
b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor);
|
||||||
|
/* The ONEPASS_DESIRED flags never occurs together with ORDER BY */
|
||||||
|
assert( (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || b==0 );
|
||||||
if( pProbe->tnum<=0 ){
|
if( pProbe->tnum<=0 ){
|
||||||
/* Integer primary key index */
|
/* Integer primary key index */
|
||||||
pNew->wsFlags = WHERE_IPK;
|
pNew->wsFlags = WHERE_IPK;
|
||||||
@@ -4523,11 +4524,13 @@ static int whereLoopAddBtree(
|
|||||||
pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;
|
pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED;
|
||||||
|
|
||||||
/* Full scan via index */
|
/* Full scan via index */
|
||||||
if( (m==0 || b)
|
if( b
|
||||||
&& pProbe->bUnordered==0
|
|| ( m==0
|
||||||
&& (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0
|
&& pProbe->bUnordered==0
|
||||||
&& sqlite3GlobalConfig.bUseCis
|
&& (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0
|
||||||
&& OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan)
|
&& sqlite3GlobalConfig.bUseCis
|
||||||
|
&& OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan)
|
||||||
|
)
|
||||||
){
|
){
|
||||||
pNew->iSortIdx = b ? iSortIdx : 0;
|
pNew->iSortIdx = b ? iSortIdx : 0;
|
||||||
pNew->nOut = rSize;
|
pNew->nOut = rSize;
|
||||||
|
|||||||
Reference in New Issue
Block a user