1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-16 23:02:26 +03:00

Improved testing of the min/max optimization. (CVS 5373)

FossilOrigin-Name: fa07c360b708324c47c8e9931f1e2b1b24e4faf8
This commit is contained in:
drh
2008-07-08 18:05:26 +00:00
parent 49fc1f60b0
commit 0880a74633
5 changed files with 176 additions and 16 deletions

View File

@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer".
**
** $Id: where.c,v 1.311 2008/06/26 18:04:03 danielk1977 Exp $
** $Id: where.c,v 1.312 2008/07/08 18:05:26 drh Exp $
*/
#include "sqliteInt.h"
@@ -2157,7 +2157,8 @@ WhereInfo *sqlite3WhereBegin(
ppIdxInfo);
flags = WHERE_VIRTUALTABLE;
pIndex = *ppIdxInfo;
if( pIndex && pIndex->orderByConsumed ){
assert( pIndex!=0 );
if( pIndex->orderByConsumed ){
flags = WHERE_VIRTUALTABLE | WHERE_ORDERBY;
}
pIdx = 0;
@@ -2546,8 +2547,9 @@ WhereInfo *sqlite3WhereBegin(
if( (wflags&WHERE_ORDERBY_MIN)!=0
&& (pLevel->flags&WHERE_ORDERBY)
&& (pIdx->nColumn>nEq)
&& (pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq])
){
assert( pOrderBy->nExpr==1 );
assert( pOrderBy->a[0].pExpr->iColumn==pIdx->aiColumn[nEq] );
isMinQuery = 1;
}