1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Change the SQLITE_Stat34 bit of the optimization test-control so that it

prevents STAT4 data from being used but allows it to be loaded into the
Index objects.  This permits STAT4 to be turned on and off on a per-statement
basis.

FossilOrigin-Name: 489f3caf5dcc8cace20a0da58ceb32fdea5770ba570fa3c9f712cd35e726846a
This commit is contained in:
drh
2018-07-20 19:24:02 +00:00
parent 040d77aa71
commit 72d03a646c
4 changed files with 13 additions and 10 deletions

View File

@@ -1436,7 +1436,9 @@ static int whereRangeScanEst(
Index *p = pLoop->u.btree.pIndex;
int nEq = pLoop->u.btree.nEq;
if( p->nSample>0 && nEq<p->nSampleCol ){
if( p->nSample>0 && nEq<p->nSampleCol
&& OptimizationEnabled(pParse->db, SQLITE_Stat34)
){
if( nEq==pBuilder->nRecValid ){
UnpackedRecord *pRec = pBuilder->pRec;
tRowcnt a[2];
@@ -2584,6 +2586,7 @@ static int whereLoopAddBtreeIndex(
&& pProbe->nSample
&& pNew->u.btree.nEq<=pProbe->nSampleCol
&& ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
&& OptimizationEnabled(db, SQLITE_Stat34)
){
Expr *pExpr = pTerm->pExpr;
if( (eOp & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){