Make ORDER BY ROWID fast

Fixes #11
This commit is contained in:
Colin Dellow 2018-06-24 15:07:27 -04:00
parent b774973852
commit 5b59ba02fe
1 changed files with 6 additions and 0 deletions

View File

@ -658,6 +658,12 @@ static int parquetBestIndex(
pIdxInfo->estimatedCost = 1; pIdxInfo->estimatedCost = 1;
pIdxInfo->idxNum = 1; pIdxInfo->idxNum = 1;
int j = 0; int j = 0;
// We traverse in rowid ascending order, so if they're asking for it to be ordered like that,
// we can tell SQLite that it's guaranteed. This speeds up some DB viewer utilities that
// use rowids for pagination.
if(pIdxInfo->nOrderBy == 1 && pIdxInfo->aOrderBy[0].iColumn == -1 && pIdxInfo->aOrderBy[0].desc == 0)
pIdxInfo->orderByConsumed = 1;
for(int i = 0; i < pIdxInfo->nConstraint; i++) { for(int i = 0; i < pIdxInfo->nConstraint; i++) {
if(pIdxInfo->aConstraint[i].usable) { if(pIdxInfo->aConstraint[i].usable) {
j++; j++;