mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Fix a problem causing the planner to generate sub-optimal plans for some queries
that use recursive WITH sub-queries with LIMIT clauses. FossilOrigin-Name: 053a149cc8244a7f85137129cfcb8622efe90306
This commit is contained in:
@@ -2037,6 +2037,7 @@ static void generateWithRecursiveQuery(
|
||||
|
||||
/* Process the LIMIT and OFFSET clauses, if they exist */
|
||||
addrBreak = sqlite3VdbeMakeLabel(v);
|
||||
p->nSelectRow = 320; /* 4 billion rows */
|
||||
computeLimitRegisters(pParse, p, addrBreak);
|
||||
pLimit = p->pLimit;
|
||||
pOffset = p->pOffset;
|
||||
@@ -5170,7 +5171,9 @@ int sqlite3Select(
|
||||
/* Set the limiter.
|
||||
*/
|
||||
iEnd = sqlite3VdbeMakeLabel(v);
|
||||
p->nSelectRow = 320; /* 4 billion rows */
|
||||
if( (p->selFlags & SF_FixedLimit)==0 ){
|
||||
p->nSelectRow = 320; /* 4 billion rows */
|
||||
}
|
||||
computeLimitRegisters(pParse, p, iEnd);
|
||||
if( p->iLimit==0 && sSort.addrSortIndex>=0 ){
|
||||
sqlite3VdbeChangeOpcode(v, sSort.addrSortIndex, OP_SorterOpen);
|
||||
|
||||
Reference in New Issue
Block a user