mirror of
https://github.com/sqlite/sqlite.git
synced 2026-01-06 08:01:16 +03:00
Disable the table selection rule that tried to prevent full table scans from
migrating to the outer loop unless they were optimal. The new scaling of outer-loop costs by cost of inner loops obviates the need for that step. And, in fact, that step causes problems with the new inner-loop cost accounting. FossilOrigin-Name: 51bfd63b7f9fe53831570ad124c932cb3582b104
This commit is contained in:
17
src/where.c
17
src/where.c
@@ -4744,16 +4744,6 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Return TRUE if the wsFlags indicate that a full table scan (or a
|
||||
** full scan of a covering index) is indicated.
|
||||
*/
|
||||
static int isFullscan(unsigned wsFlags){
|
||||
if( wsFlags & WHERE_COVER_SCAN ) return 1;
|
||||
if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Generate the beginning of the loop used for WHERE clause processing.
|
||||
@@ -5132,8 +5122,8 @@ WhereInfo *sqlite3WhereBegin(
|
||||
** yet run. (In other words, it must not depend on tables
|
||||
** in inner loops.)
|
||||
**
|
||||
** (2) A full-table-scan plan cannot supercede indexed plan unless
|
||||
** the full-table-scan is an "optimal" plan as defined above.
|
||||
** (2) (This rule was removed on 2012-11-09. The scaling of the
|
||||
** cost using the optimal scan cost made this rule obsolete.)
|
||||
**
|
||||
** (3) All tables have an INDEXED BY clause or this table lacks an
|
||||
** INDEXED BY clause or this table uses the specific
|
||||
@@ -5148,9 +5138,6 @@ WhereInfo *sqlite3WhereBegin(
|
||||
** is defined by the compareCost() function above.
|
||||
*/
|
||||
if( (sWBI.cost.used&sWBI.notValid)==0 /* (1) */
|
||||
&& (bestJ<0 || (notIndexed&m)!=0 /* (2) */
|
||||
|| isFullscan(bestPlan.plan.wsFlags)
|
||||
|| !isFullscan(sWBI.cost.plan.wsFlags))
|
||||
&& (nUnconstrained==0 || sWBI.pSrc->pIndex==0 /* (3) */
|
||||
|| NEVER((sWBI.cost.plan.wsFlags & WHERE_NOT_FULLSCAN)!=0))
|
||||
&& (bestJ<0 || compareCost(&sWBI.cost, &bestPlan)) /* (4) */
|
||||
|
||||
Reference in New Issue
Block a user