mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-19 21:43:15 +03:00
Update the NGQP to make use of STAT3 information if it is available.
FossilOrigin-Name: ff134e6ee95d41b0e59e03bba7e94bc15b04ff8c
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Honor\sthe\sorderByConsumed\sboolean\sreturned\sfrom\svirtual\stable\squery\splanner.
|
C Update\sthe\sNGQP\sto\smake\suse\sof\sSTAT3\sinformation\sif\sit\sis\savailable.
|
||||||
D 2013-06-03T16:56:37.438
|
D 2013-06-03T17:35:22.501
|
||||||
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 82c6fd16a6344108eac33642414958dc8db20d32
|
F src/where.c a60b27296226bc073ae87988f7cec222d9523d7d
|
||||||
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
|
||||||
@@ -1093,7 +1093,7 @@ F tool/vdbe-compress.tcl f12c884766bd14277f4fcedcae07078011717381
|
|||||||
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
|
||||||
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
|
||||||
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
|
||||||
P 62d382406b28c1347e13114f42215939ddfd7a9d
|
P aaf7f5896d3523531e1a9a1b90c4ad326f0c8fc7
|
||||||
R 6374db7e82d972462ef1160c4988e05a
|
R 821d5edba86d3e2ff0b1efea7de5e5d1
|
||||||
U drh
|
U drh
|
||||||
Z 8802671c91d46932119ceee1b71a0d50
|
Z 967f742fe27d5833ce434e13ad275aee
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
aaf7f5896d3523531e1a9a1b90c4ad326f0c8fc7
|
ff134e6ee95d41b0e59e03bba7e94bc15b04ff8c
|
||||||
29
src/where.c
29
src/where.c
@@ -3965,6 +3965,7 @@ static int whereLoopAddBtreeIndex(
|
|||||||
int rc = SQLITE_OK; /* Return code */
|
int rc = SQLITE_OK; /* Return code */
|
||||||
tRowcnt iRowEst; /* Estimated index selectivity */
|
tRowcnt iRowEst; /* Estimated index selectivity */
|
||||||
double rLogSize; /* Logarithm of table size */
|
double rLogSize; /* Logarithm of table size */
|
||||||
|
WhereTerm *pTop, *pBtm; /* Top and bottom range constraints */
|
||||||
|
|
||||||
db = pBuilder->db;
|
db = pBuilder->db;
|
||||||
pNew = pBuilder->pNew;
|
pNew = pBuilder->pNew;
|
||||||
@@ -4031,12 +4032,35 @@ static int whereLoopAddBtreeIndex(
|
|||||||
pNew->nOut = (double)iRowEst * nInMul;
|
pNew->nOut = (double)iRowEst * nInMul;
|
||||||
}else if( pTerm->eOperator & (WO_GT|WO_GE) ){
|
}else if( pTerm->eOperator & (WO_GT|WO_GE) ){
|
||||||
pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT;
|
pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT;
|
||||||
pNew->nOut = savedLoop.nOut/3;
|
pBtm = pTerm;
|
||||||
|
pTop = 0;
|
||||||
}else if( pTerm->eOperator & (WO_LT|WO_LE) ){
|
}else if( pTerm->eOperator & (WO_LT|WO_LE) ){
|
||||||
pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT;
|
pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT;
|
||||||
pNew->nOut = savedLoop.nOut/3;
|
pTop = pTerm;
|
||||||
|
pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ?
|
||||||
|
pNew->aTerm[pNew->nTerm-2] : 0;
|
||||||
}
|
}
|
||||||
pNew->rRun = rLogSize*nIn; /* Cost for nIn binary searches */
|
pNew->rRun = rLogSize*nIn; /* Cost for nIn binary searches */
|
||||||
|
if( pNew->wsFlags & WHERE_COLUMN_RANGE ){
|
||||||
|
/* Adjust nOut and rRun for STAT3 range values */
|
||||||
|
double rDiv;
|
||||||
|
whereRangeScanEst(pBuilder->pParse, pProbe, pNew->u.btree.nEq,
|
||||||
|
pBtm, pTop, &rDiv);
|
||||||
|
pNew->nOut = savedLoop.nOut/rDiv;
|
||||||
|
}
|
||||||
|
#ifdef SQLITE_ENABLE_STAT3
|
||||||
|
if( pNew->u.btree.nEq==1 && pProbe->nSample ){
|
||||||
|
if( (pTerm->eOperator & (WO_EQ|WO_ISNULL))!=0 ){
|
||||||
|
rc = whereEqualScanEst(pBuilder->pParse, pProbe, pTerm->pExpr->pRight,
|
||||||
|
&pNew->nOut);
|
||||||
|
}else if( (pTerm->eOperator & WO_IN)
|
||||||
|
&& !ExprHasProperty(pTerm->pExpr, EP_xIsSelect) ){
|
||||||
|
rc = whereInScanEst(pBuilder->pParse, pProbe, pTerm->pExpr->x.pList,
|
||||||
|
&pNew->nOut);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if( pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK) ){
|
if( pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK) ){
|
||||||
pNew->rRun += pNew->nOut; /* Unit step cost to reach each row */
|
pNew->rRun += pNew->nOut; /* Unit step cost to reach each row */
|
||||||
}else{
|
}else{
|
||||||
@@ -4044,7 +4068,6 @@ static int whereLoopAddBtreeIndex(
|
|||||||
** the main table */
|
** the main table */
|
||||||
pNew->rRun += pNew->nOut*(1 + rLogSize);
|
pNew->rRun += pNew->nOut*(1 + rLogSize);
|
||||||
}
|
}
|
||||||
/* TBD: Adjust nOut and rRun for STAT3 range values */
|
|
||||||
/* TBD: Adjust nOut for additional constraints */
|
/* TBD: Adjust nOut for additional constraints */
|
||||||
rc = whereLoopInsert(pBuilder, pNew);
|
rc = whereLoopInsert(pBuilder, pNew);
|
||||||
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
|
if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0
|
||||||
|
|||||||
Reference in New Issue
Block a user