mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Avoid a performance problem when very large "VALUES(..), (..), (..)" terms are
used in queries. FossilOrigin-Name: f5306ad6816cc377036685cdae227e762885229c
This commit is contained in:
15
manifest
15
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Modify\sthe\ssqlite3SelectDup()\sroutine\sto\savoid\srecursing\son\sSelect.pPrior.
|
C Avoid\sa\sperformance\sproblem\swhen\svery\slarge\s"VALUES(..),\s(..),\s(..)"\sterms\sare\nused\sin\squeries.
|
||||||
D 2017-02-03T14:44:52.406
|
D 2017-02-03T19:16:39.919
|
||||||
F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc
|
F Makefile.in 5f415e7867296d678fed2e6779aea10c1318b4bc
|
||||||
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
|
||||||
F Makefile.msc ba953c8921fc7e18333f61898007206de7e23964
|
F Makefile.msc ba953c8921fc7e18333f61898007206de7e23964
|
||||||
@@ -393,7 +393,7 @@ F src/printf.c ff10a9b9902cd2afe5f655f3013c6307d969b1fd
|
|||||||
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||||
F src/resolve.c f9bc0de45a30a450da47b3766de00be89bf9be79
|
F src/resolve.c f9bc0de45a30a450da47b3766de00be89bf9be79
|
||||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||||
F src/select.c 3856db523b942062bca8722ba03b61c324ff94d6
|
F src/select.c d12f3539f80db38b09015561b569e0eb1c4b6c5f
|
||||||
F src/shell.c a84e453c213f3e0d6935a582024da4e242f85a19
|
F src/shell.c a84e453c213f3e0d6935a582024da4e242f85a19
|
||||||
F src/sqlite.h.in 751ff125eb159c8f92c182b8df980a5e4f50e966
|
F src/sqlite.h.in 751ff125eb159c8f92c182b8df980a5e4f50e966
|
||||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||||
@@ -1552,10 +1552,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
|||||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||||
P 8e03a8e95fada5c24d369672a71f6e02288051da
|
P a7674ead5be986c66f7d61d598adc7e5728bcd30
|
||||||
R c80f7dbbf5f0044354e4b463e716c13e
|
R 1275850dbdc882ce3db2a9a335b19414
|
||||||
T *branch * recursive-selectdup
|
|
||||||
T *sym-recursive-selectdup *
|
|
||||||
T -sym-trunk *
|
|
||||||
U dan
|
U dan
|
||||||
Z f43da81961eb4c39992192293f7e5a2c
|
Z aab63e41186ee170ee1c431b74360517
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
a7674ead5be986c66f7d61d598adc7e5728bcd30
|
f5306ad6816cc377036685cdae227e762885229c
|
||||||
18
src/select.c
18
src/select.c
@@ -4186,7 +4186,15 @@ static int withExpand(
|
|||||||
pCte->zCteErr = "circular reference: %s";
|
pCte->zCteErr = "circular reference: %s";
|
||||||
pSavedWith = pParse->pWith;
|
pSavedWith = pParse->pWith;
|
||||||
pParse->pWith = pWith;
|
pParse->pWith = pWith;
|
||||||
sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel);
|
if( bMayRecursive ){
|
||||||
|
Select *pPrior = pSel->pPrior;
|
||||||
|
assert( pPrior->pWith==0 );
|
||||||
|
pPrior->pWith = pSel->pWith;
|
||||||
|
sqlite3WalkSelect(pWalker, pPrior);
|
||||||
|
pPrior->pWith = 0;
|
||||||
|
}else{
|
||||||
|
sqlite3WalkSelect(pWalker, pSel);
|
||||||
|
}
|
||||||
pParse->pWith = pWith;
|
pParse->pWith = pWith;
|
||||||
|
|
||||||
for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
|
for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior);
|
||||||
@@ -4230,11 +4238,13 @@ static int withExpand(
|
|||||||
*/
|
*/
|
||||||
static void selectPopWith(Walker *pWalker, Select *p){
|
static void selectPopWith(Walker *pWalker, Select *p){
|
||||||
Parse *pParse = pWalker->pParse;
|
Parse *pParse = pWalker->pParse;
|
||||||
|
if( pParse->pWith && p->pPrior==0 ){
|
||||||
With *pWith = findRightmost(p)->pWith;
|
With *pWith = findRightmost(p)->pWith;
|
||||||
if( pWith!=0 ){
|
if( pWith!=0 ){
|
||||||
assert( pParse->pWith==pWith );
|
assert( pParse->pWith==pWith );
|
||||||
pParse->pWith = pWith->pOuter;
|
pParse->pWith = pWith->pOuter;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define selectPopWith 0
|
#define selectPopWith 0
|
||||||
@@ -4283,8 +4293,8 @@ static int selectExpander(Walker *pWalker, Select *p){
|
|||||||
}
|
}
|
||||||
pTabList = p->pSrc;
|
pTabList = p->pSrc;
|
||||||
pEList = p->pEList;
|
pEList = p->pEList;
|
||||||
if( pWalker->xSelectCallback2==selectPopWith ){
|
if( p->pWith ){
|
||||||
sqlite3WithPush(pParse, findRightmost(p)->pWith, 0);
|
sqlite3WithPush(pParse, p->pWith, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure cursor numbers have been assigned to all entries in
|
/* Make sure cursor numbers have been assigned to all entries in
|
||||||
@@ -4571,9 +4581,7 @@ static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
|
|||||||
sqlite3WalkSelect(&w, pSelect);
|
sqlite3WalkSelect(&w, pSelect);
|
||||||
}
|
}
|
||||||
w.xSelectCallback = selectExpander;
|
w.xSelectCallback = selectExpander;
|
||||||
if( (pSelect->selFlags & SF_MultiValue)==0 ){
|
|
||||||
w.xSelectCallback2 = selectPopWith;
|
w.xSelectCallback2 = selectPopWith;
|
||||||
}
|
|
||||||
sqlite3WalkSelect(&w, pSelect);
|
sqlite3WalkSelect(&w, pSelect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user