diff options
author | drh <drh@noemail.net> | 2019-08-08 16:23:12 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2019-08-08 16:23:12 +0000 |
commit | 5eae1d1b33b376fab31497cbdb129e2e065568c8 (patch) | |
tree | 4f749490304f1b1becc88873f480279f873a2f5d /src | |
parent | 175b8f06f7fcf75d95e70f5b2232a5535055ac13 (diff) | |
download | sqlite-5eae1d1b33b376fab31497cbdb129e2e065568c8.tar.gz sqlite-5eae1d1b33b376fab31497cbdb129e2e065568c8.zip |
More legacy STAT3 code removed.
FossilOrigin-Name: 845d2f17de5b4740f95884307d9efec3223737bb0f2c4a74693666caf5f61c21
Diffstat (limited to 'src')
-rw-r--r-- | src/analyze.c | 4 | ||||
-rw-r--r-- | src/sqliteInt.h | 4 | ||||
-rw-r--r-- | src/test1.c | 2 | ||||
-rw-r--r-- | src/where.c | 6 | ||||
-rw-r--r-- | src/whereexpr.c | 2 |
5 files changed, 8 insertions, 10 deletions
diff --git a/src/analyze.c b/src/analyze.c index 8d792267f..31fb6f5b5 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -1684,9 +1684,7 @@ static int loadStatTbl( nSample = sqlite3_column_int(pStmt, 1); pIdx = findIndexOrPrimaryKey(db, zIndex, zDb); assert( pIdx==0 || pIdx->nSample==0 ); - /* Index.nSample is non-zero at this point if data has already been - ** loaded from the stat4 table. */ - if( pIdx==0 || pIdx->nSample ) continue; + if( pIdx==0 ) continue; assert( !HasRowid(pIdx->pTable) || pIdx->nColumn==pIdx->nKeyCol+1 ); if( !HasRowid(pIdx->pTable) && IsPrimaryKeyIndex(pIdx) ){ nIdxCol = pIdx->nKeyCol; diff --git a/src/sqliteInt.h b/src/sqliteInt.h index 4792919ac..efe8e1b97 100644 --- a/src/sqliteInt.h +++ b/src/sqliteInt.h @@ -1573,8 +1573,8 @@ struct sqlite3 { #define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */ #define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */ #define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */ -#define SQLITE_Stat34 0x0800 /* Use STAT4 data */ - /* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */ +#define SQLITE_Stat4 0x0800 /* Use STAT4 data */ + /* TH3 expects the Stat4 ^^^^^^ value to be 0x0800. Don't change it */ #define SQLITE_PushDown 0x1000 /* The push-down optimization */ #define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */ #define SQLITE_SkipScan 0x4000 /* Skip-scans */ diff --git a/src/test1.c b/src/test1.c index 503a27009..6bc64e762 100644 --- a/src/test1.c +++ b/src/test1.c @@ -7173,7 +7173,7 @@ static int SQLITE_TCLAPI optimization_control( { "order-by-idx-join", SQLITE_OrderByIdxJoin }, { "transitive", SQLITE_Transitive }, { "omit-noop-join", SQLITE_OmitNoopJoin }, - { "stat4", SQLITE_Stat34 }, + { "stat4", SQLITE_Stat4 }, { "skip-scan", SQLITE_SkipScan }, }; diff --git a/src/where.c b/src/where.c index ebf447a31..65c92863a 100644 --- a/src/where.c +++ b/src/where.c @@ -1474,8 +1474,8 @@ static int whereRangeScanEst( Index *p = pLoop->u.btree.pIndex; int nEq = pLoop->u.btree.nEq; - if( p->nSample>0 && nEq<p->nSampleCol - && OptimizationEnabled(pParse->db, SQLITE_Stat34) + if( p->nSample>0 && ALWAYS(nEq<p->nSampleCol) + && OptimizationEnabled(pParse->db, SQLITE_Stat4) ){ if( nEq==pBuilder->nRecValid ){ UnpackedRecord *pRec = pBuilder->pRec; @@ -2633,7 +2633,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) + && OptimizationEnabled(db, SQLITE_Stat4) ){ Expr *pExpr = pTerm->pExpr; if( (eOp & (WO_EQ|WO_ISNULL|WO_IS))!=0 ){ diff --git a/src/whereexpr.c b/src/whereexpr.c index 155cef715..252d924b8 100644 --- a/src/whereexpr.c +++ b/src/whereexpr.c @@ -1393,7 +1393,7 @@ static void exprAnalyze( && pExpr->pLeft->op==TK_COLUMN && pExpr->pLeft->iColumn>=0 && !ExprHasProperty(pExpr, EP_FromJoin) - && OptimizationEnabled(db, SQLITE_Stat34) + && OptimizationEnabled(db, SQLITE_Stat4) ){ Expr *pNewExpr; Expr *pLeft = pExpr->pLeft; |