Size and performance optimizations to sqlite3ResolveExprNames().

FossilOrigin-Name: af8c0fed93c830c50641d95691bb507c31947a15529aba2a88bfaa66b3a3287a
This commit is contained in:
drh 2017-05-31 00:49:40 +00:00
parent 2ab792e4c0
commit d03257c141
4 changed files with 18 additions and 24 deletions

View File

@ -1,5 +1,5 @@
C Change\ssqlite3BtreeNext()\sand\ssqlite3BtreePrevious()\sso\sthat\sthey\sreturn\nSQLITE_DONE\sif\sthey\shave\salready\sreached\sthe\send\s(or\sbeginning)\sof\sthe\stable.\nThis\sgives\sa\sperformance\sincrease\sand\ssize\sreduction.
D 2017-05-30T18:34:07.003
C Size\sand\sperformance\soptimizations\sto\ssqlite3ResolveExprNames().
D 2017-05-31T00:49:40.197
F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
F Makefile.msc 8eeb80162074004e906b53d7340a12a14c471a83743aab975947e95ce061efcc
@ -402,14 +402,14 @@ F src/pragma.h 37a1311d0388db480388d7ec09054f7103045eff20d4971f8a433b77f40b9921
F src/prepare.c b1140c3d0cf59bc85ace00ce363153041b424b7a
F src/printf.c 8757834f1b54dae512fb25eb1acc8e94a0d15dd2290b58f2563f65973265adb2
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
F src/resolve.c ffb69e203f18a7c4013c0b37e657e19abd61379c92480dbbd582bd365c5876aa
F src/resolve.c adf3ef9843135b1383321ad751f16f5a40c3f37925154555a3e61653d2a954e8
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
F src/select.c fd0a17fb78130fe840a33024888d41c77ed0bab0340b72cf71b1558d5f465e88
F src/shell.c 3f761fe604174b31aacd2ea2eacef5e6fe550111d60c0d71532cc008c68cf3f3
F src/sqlite.h.in 8dd468837a4f6d76713e3a4cc65bea48095009038593d41040ab46c1b351197f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 58fd0676d3111d02e62e5a35992a7d3da5d3f88753acc174f2d37b774fbbdd28
F src/sqliteInt.h 80c485ad08b1091a6148637c1b9c334be6ab39cb0d28b839bab96e6783b9d006
F src/sqliteInt.h 4faf6f2542949b61fd0aa69233dd23ad3469656c24085e874dbfa2e0cc03b901
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c a9e66593dfb28a9e746cba7153f84d49c1ddc4b1
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@ -1581,7 +1581,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P 69ae688982d6cb9f859f5643c315a1dc5ba76ad35553ecea8329a75ee70a87b1
R 01f70d2b820b4999a40771b05d021f40
P e972a3860892022d57b26ec44ce0fbadc61c1ff54b7a10b7e82390db88d323a7
R 834d3387387da9d103b939ffc6cd81e1
U drh
Z 9376a3b7b02b59becba99aee408544a5
Z d53818aaf774b30faf87723ebcc57f14

View File

@ -1 +1 @@
e972a3860892022d57b26ec44ce0fbadc61c1ff54b7a10b7e82390db88d323a7
af8c0fed93c830c50641d95691bb507c31947a15529aba2a88bfaa66b3a3287a

View File

@ -1430,16 +1430,7 @@ int sqlite3ResolveExprNames(
u16 savedHasAgg;
Walker w;
if( pExpr==0 ) return 0;
#if SQLITE_MAX_EXPR_DEPTH>0
{
Parse *pParse = pNC->pParse;
if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){
return 1;
}
pParse->nHeight += pExpr->nHeight;
}
#endif
if( pExpr==0 ) return SQLITE_OK;
savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg);
pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg);
w.pParse = pNC->pParse;
@ -1447,18 +1438,21 @@ int sqlite3ResolveExprNames(
w.xSelectCallback = resolveSelectStep;
w.xSelectCallback2 = 0;
w.u.pNC = pNC;
#if SQLITE_MAX_EXPR_DEPTH>0
w.pParse->nHeight += pExpr->nHeight;
if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){
return SQLITE_ERROR;
}
#endif
sqlite3WalkExpr(&w, pExpr);
#if SQLITE_MAX_EXPR_DEPTH>0
pNC->pParse->nHeight -= pExpr->nHeight;
w.pParse->nHeight -= pExpr->nHeight;
#endif
if( pNC->nErr>0 || w.pParse->nErr>0 ){
ExprSetProperty(pExpr, EP_Error);
}
if( pNC->ncFlags & NC_HasAgg ){
ExprSetProperty(pExpr, EP_Agg);
}
pNC->ncFlags |= savedHasAgg;
return ExprHasProperty(pExpr, EP_Error);
return pNC->nErr>0 || w.pParse->nErr>0;
}
/*

View File

@ -2364,7 +2364,7 @@ struct Expr {
#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
#define EP_Error 0x000008 /* Expression contains one or more errors */
/* 0x000008 // available for use */
#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */