1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Further enhancements to the min/max optimization of

[/info/b8ba2f17f938c035|check-in b8ba2f17f938c035] to fix the performance
regression identified by
[forum:/forumpost/623f571482|forum post 623f571482].

FossilOrigin-Name: 188772a1dbaf066fbddd39c718fdd87478b19a920622f4640bcb79d4ef065331
This commit is contained in:
drh
2021-01-13 15:23:17 +00:00
parent aa556b0fa7
commit d193057ad1
5 changed files with 39 additions and 14 deletions

View File

@@ -6773,7 +6773,7 @@ int sqlite3Select(
/* End of the loop
*/
if( groupBySort ){
sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx, addrTopOfLoop);
sqlite3VdbeAddOp2(v, OP_SorterNext, pAggInfo->sortingIdx,addrTopOfLoop);
VdbeCoverage(v);
}else{
sqlite3WhereEnd(pWInfo);
@@ -6885,7 +6885,6 @@ int sqlite3Select(
explainSimpleCount(pParse, pTab, pBest);
}else{
int regAcc = 0; /* "populate accumulators" flag */
int addrSkip;
/* If there are accumulator registers but no min() or max() functions
** without FILTER clauses, allocate register regAcc. Register regAcc
@@ -6934,9 +6933,8 @@ int sqlite3Select(
}
updateAccumulator(pParse, regAcc, pAggInfo);
if( regAcc ) sqlite3VdbeAddOp2(v, OP_Integer, 1, regAcc);
addrSkip = sqlite3WhereOrderByLimitOptLabel(pWInfo);
if( addrSkip!=sqlite3WhereContinueLabel(pWInfo) ){
sqlite3VdbeGoto(v, addrSkip);
if( minMaxFlag ){
sqlite3WhereMinMaxOptEarlyOut(v, pWInfo);
}
sqlite3WhereEnd(pWInfo);
finalizeAggFunctions(pParse, pAggInfo);