1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-15 11:41:13 +03:00

Add logic to the query planner to only use partial indices if the WHERE clause

constrains the search to rows covered by the partial index.  This is just
infrastructure.  The key routine, sqlite3ExprImpliesExpr(), is currently a
no-op so that partial indices will never be used.

FossilOrigin-Name: 8ca3eac111e06a1854f878a74bffe8f20eb47f1b
This commit is contained in:
drh
2013-07-31 23:22:39 +00:00
parent 3780be115a
commit 4bd5f73fa0
5 changed files with 47 additions and 10 deletions

View File

@@ -3865,6 +3865,26 @@ int sqlite3ExprListCompare(ExprList *pA, ExprList *pB){
return 0;
}
/*
** Return true if we can prove the pE2 will always be true if pE1 is
** true. Return false if we cannot complete the proof or if pE2 might
** be false. Examples:
**
** pE1: x==5 pE2: x>0 Result: true
** pE1: x>0 pE2: x==5 Result: false
** pE1: x!=123 pE2: x IS NOT NULL Result: true
**
** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has
** Expr.iTable<0 then assume a table number given by iTab.
**
** When in doubt, return false. Returning true might give a performance
** improvement. Returning false might cause a performance reduction, but
** it will always give the correct answer and is hence always safe.
*/
int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){
return 0; /* FIXME: this needs to be worked out */
}
/*
** An instance of the following structure is used by the tree walker
** to count references to table columns in the arguments of an