aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2014-10-22 19:57:16 +0000
committerdrh <drh@noemail.net>2014-10-22 19:57:16 +0000
commitd7d71470226bcc59799713b95ad9e10f9eff63cc (patch)
treecf21a63a0d00dbf32cea20a84207e3a494f14d1d /src
parent9f07cf7b2e43548f60bd7497dafba30856df3531 (diff)
downloadsqlite-d7d71470226bcc59799713b95ad9e10f9eff63cc.tar.gz
sqlite-d7d71470226bcc59799713b95ad9e10f9eff63cc.zip
Change the 0x800 bit of SQLITE_TESTCTRL_OPTIMIZATIONS so that it disables
the loading of STAT3 and STAT4 content, not just the using of that content. Change the internal name of that bit to SQLITE_Stat34. FossilOrigin-Name: ca3b00c44ec52d209642a5ba9ef82e085fac39db
Diffstat (limited to 'src')
-rw-r--r--src/analyze.c2
-rw-r--r--src/sqliteInt.h2
-rw-r--r--src/test1.c3
-rw-r--r--src/where.c4
4 files changed, 5 insertions, 6 deletions
diff --git a/src/analyze.c b/src/analyze.c
index 67bba1a28..597885237 100644
--- a/src/analyze.c
+++ b/src/analyze.c
@@ -1861,7 +1861,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 ){
+ if( rc==SQLITE_OK && OptimizationEnabled(db, SQLITE_Stat34) ){
int lookasideEnabled = db->lookaside.bEnabled;
db->lookaside.bEnabled = 0;
rc = loadStat4(db, sInfo.zDatabase);
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 5409f7086..1b3138be4 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -1214,7 +1214,7 @@ struct sqlite3 {
#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
#define SQLITE_Transitive 0x0200 /* Transitive constraints */
#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
-#define SQLITE_Stat3 0x0800 /* Use the SQLITE_STAT3 table */
+#define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
#define SQLITE_AllOpts 0xffff /* All optimizations */
/*
diff --git a/src/test1.c b/src/test1.c
index 85a16488b..802aa99b5 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -6293,7 +6293,8 @@ static int optimization_control(
{ "transitive", SQLITE_Transitive },
{ "subquery-coroutine", SQLITE_SubqCoroutine },
{ "omit-noop-join", SQLITE_OmitNoopJoin },
- { "stat3", SQLITE_Stat3 },
+ { "stat3", SQLITE_Stat34 },
+ { "stat4", SQLITE_Stat34 },
};
if( objc!=4 ){
diff --git a/src/where.c b/src/where.c
index f708d7fad..198a6c3fd 100644
--- a/src/where.c
+++ b/src/where.c
@@ -1350,7 +1350,7 @@ static void exprAnalyze(
if( pExpr->op==TK_NOTNULL
&& pExpr->pLeft->op==TK_COLUMN
&& pExpr->pLeft->iColumn>=0
- && OptimizationEnabled(db, SQLITE_Stat3)
+ && OptimizationEnabled(db, SQLITE_Stat34)
){
Expr *pNewExpr;
Expr *pLeft = pExpr->pLeft;
@@ -2159,7 +2159,6 @@ static int whereRangeScanEst(
if( p->nSample>0
&& nEq<p->nSampleCol
- && OptimizationEnabled(pParse->db, SQLITE_Stat3)
){
if( nEq==pBuilder->nRecValid ){
UnpackedRecord *pRec = pBuilder->pRec;
@@ -4422,7 +4421,6 @@ static int whereLoopAddBtreeIndex(
if( nInMul==0
&& pProbe->nSample
&& pNew->u.btree.nEq<=pProbe->nSampleCol
- && OptimizationEnabled(db, SQLITE_Stat3)
&& ((eOp & WO_IN)==0 || !ExprHasProperty(pTerm->pExpr, EP_xIsSelect))
){
Expr *pExpr = pTerm->pExpr;