1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Enhance the query planner so that it is able to use partial indexes that use

AND-connected terms in the WHERE clause.

FossilOrigin-Name: 065765902d2774d7432b9c00ea2efed26e0aaa5e
This commit is contained in:
drh
2015-08-07 20:57:00 +00:00
parent 5a790285a0
commit cf599b6ade
4 changed files with 43 additions and 9 deletions

View File

@@ -2423,6 +2423,10 @@ static Bitmask columnsInIndex(Index *pIdx){
static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
int i;
WhereTerm *pTerm;
while( pWhere->op==TK_AND ){
if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0;
pWhere = pWhere->pRight;
}
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
Expr *pExpr = pTerm->pExpr;
if( sqlite3ExprImpliesExpr(pExpr, pWhere, iTab)