aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2018-04-18 19:56:14 +0000
committerdan <dan@noemail.net>2018-04-18 19:56:14 +0000
commitdedff6be8a98c7781b375c510c508202ad038acc (patch)
treeccc6062f59fc78d2b81ce2189bf1593e301cefda /src/expr.c
parent52b3e340cc3e3044f2538ee7d2efcdba02965b16 (diff)
parent5a2e65ed633df2d208c591e7520456ed79ad3385 (diff)
downloadsqlite-dedff6be8a98c7781b375c510c508202ad038acc.tar.gz
sqlite-dedff6be8a98c7781b375c510c508202ad038acc.zip
Add the "sorter-reference" optimization, allowing SQLite to be configured so
that some required values may be loaded from the database after external sorting occurs for SELECT statements with ORDER BY clauses that are not satisfied by database indexes. FossilOrigin-Name: ef74090a40ceaef2fd93a7613ec99a191ce986811c852e96f4a19719f18af4f0
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index 534fdfe6b..6997e8430 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -1363,6 +1363,7 @@ ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){
pItem->sortOrder = pOldItem->sortOrder;
pItem->done = 0;
pItem->bSpanIsTab = pOldItem->bSpanIsTab;
+ pItem->bSorterRef = pOldItem->bSorterRef;
pItem->u = pOldItem->u;
}
return pNew;
@@ -4373,6 +4374,12 @@ int sqlite3ExprCodeExprList(
if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR;
for(pItem=pList->a, i=0; i<n; i++, pItem++){
Expr *pExpr = pItem->pExpr;
+#ifdef SQLITE_ENABLE_SORTER_REFERENCES
+ if( pItem->bSorterRef ){
+ i--;
+ n--;
+ }else
+#endif
if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){
if( flags & SQLITE_ECEL_OMITREF ){
i--;