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

Modify the query planner interface so that it always passes in the result set.

This is the first step toward adding an optimization that will omit tables
from a join that do not contribute to the result.

FossilOrigin-Name: 2c2577e69ccb47f1af674a755e71221e2ca0b322
This commit is contained in:
drh
2013-06-21 00:35:37 +00:00
parent 472eae8a4d
commit 6457a353bc
6 changed files with 48 additions and 38 deletions

View File

@@ -4261,15 +4261,16 @@ int sqlite3Select(
if( !isAgg && pGroupBy==0 ){
/* No aggregate functions and no GROUP BY clause */
ExprList *pDist = (sDistinct.isTnct ? p->pEList : 0);
u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0);
/* Begin the database scan. */
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pOrderBy, pDist, 0,0);
pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pOrderBy, p->pEList,
wctrlFlags, 0);
if( pWInfo==0 ) goto select_end;
if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){
p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo);
}
if( sqlite3WhereIsDistinct(pWInfo) ){
if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){
sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo);
}
if( pOrderBy && sqlite3WhereIsOrdered(pWInfo) ) pOrderBy = 0;