diff options
author | drh <drh@noemail.net> | 2018-07-20 19:24:02 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2018-07-20 19:24:02 +0000 |
commit | 72d03a646ceca2a50551c78a27c0aef574a6dec0 (patch) | |
tree | 5811f09af64177ffcec24d9290fa10a13b9ac901 /src | |
parent | 040d77aa715cf24697e48e47a20b2302e3e48d27 (diff) | |
download | sqlite-72d03a646ceca2a50551c78a27c0aef574a6dec0.tar.gz sqlite-72d03a646ceca2a50551c78a27c0aef574a6dec0.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze.c | 2 | ||||
-rw-r--r-- | src/where.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/analyze.c b/src/analyze.c index 37b1eec0c..5075b5786 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1914,7 +1914,7 @@ int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ /* Load the statistics from the sqlite_stat4 table. */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){ + if( rc==SQLITE_OK ){ db->lookaside.bDisable++; rc = loadStat4(db, sInfo.zDatabase); db->lookaside.bDisable--; diff --git a/src/where.c b/src/where.c index aa7567fa8..d4f88a27a 100644 --- a/src/where.c +++ b/src/where.c @@ -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 ){ |