From: drh Date: Mon, 5 Jan 2015 20:04:51 +0000 (+0000) Subject: Avoid O(N*N) behavior with very long lists of VALUES. X-Git-Tag: version-3.8.8~31^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fheads%2Fmany-VALUEs;p=thirdparty%2Fsqlite.git Avoid O(N*N) behavior with very long lists of VALUES. FossilOrigin-Name: ee30fb35217f3429ee89aaad7c19f29710420e4c --- diff --git a/manifest b/manifest index d9ca18ff03..1131d6525b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Handle\scompound-select\sstatements\soriginating\sfrom\sVALUES\sclauses\sas\sa\nspecial\scase\sthat\sdoes\snot\suse\srecursion. -D 2015-01-05T19:16:42.892 +C Avoid\sO(N*N)\sbehavior\swith\svery\slong\slists\sof\sVALUES. +D 2015-01-05T20:04:51.191 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 335e2d3ff0f2455eacbfa3075fc37495e3321410 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -228,7 +228,7 @@ F src/printf.c 9e75a6a0b55bf61cfff7d7e19d89834a1b938236 F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c f6c46d3434439ab2084618d603e6d6dbeb0d6ada F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e -F src/select.c 4776e16d19296f0f93ecd9431dca8bc3e3182714 +F src/select.c e4c38c75e36f28aed80a69a725d888751bfd53df F src/shell.c 45d9c9bd7cde07845af957f2d849933b990773cf F src/sqlite.h.in ed799ff5c814227c7957eb4f4a217f67fdc0da48 F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad @@ -1235,7 +1235,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P c9d65f739ad56f016c676e79aa39080be3fe868a -R 382474f6cec467234b3ff04ac38978b4 +P 9ce9e43af38e6bc362734463d4bfc40ff0c98f8f +R 7d358a2d55ab9540987f678e54c3928e U drh -Z 33ab3e676dc0271c6784ea259fd00ed6 +Z 9bf53124e75790b3e22f8f45574d11c9 diff --git a/manifest.uuid b/manifest.uuid index e3a83ccf8f..c565f584a5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -9ce9e43af38e6bc362734463d4bfc40ff0c98f8f \ No newline at end of file +ee30fb35217f3429ee89aaad7c19f29710420e4c \ No newline at end of file diff --git a/src/select.c b/src/select.c index 5de489b86e..78b1caea8d 100644 --- a/src/select.c +++ b/src/select.c @@ -4115,7 +4115,9 @@ static int selectExpander(Walker *pWalker, Select *p){ } pTabList = p->pSrc; pEList = p->pEList; - sqlite3WithPush(pParse, findRightmost(p)->pWith, 0); + if( pWalker->xSelectCallback2==selectPopWith ){ + sqlite3WithPush(pParse, findRightmost(p)->pWith, 0); + } /* Make sure cursor numbers have been assigned to all entries in ** the FROM clause of the SELECT statement. @@ -4406,7 +4408,9 @@ static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ sqlite3WalkSelect(&w, pSelect); } w.xSelectCallback = selectExpander; - w.xSelectCallback2 = selectPopWith; + if( (pSelect->selFlags & SF_AllValues)==0 ){ + w.xSelectCallback2 = selectPopWith; + } sqlite3WalkSelect(&w, pSelect); }