aboutsummaryrefslogtreecommitdiff
path: root/src/select.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2011-04-15 14:46:27 +0000
committerdrh <drh@noemail.net>2011-04-15 14:46:27 +0000
commit3e9548b30d1a651e9d6445103d73515038dfb0ed (patch)
treee111051786f853ea0cfaeffdc0173d471feb0357 /src/select.c
parentd4a80312b82ecb61bbd40281e6872092a17274b7 (diff)
downloadsqlite-3e9548b30d1a651e9d6445103d73515038dfb0ed.tar.gz
sqlite-3e9548b30d1a651e9d6445103d73515038dfb0ed.zip
Do not do full table scans of unordered indices.
FossilOrigin-Name: a8761a9128de945aa4b6196df5ffe64115d66b61
Diffstat (limited to 'src/select.c')
-rw-r--r--src/select.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/select.c b/src/select.c
index 3a4a88168..8dcfb84b8 100644
--- a/src/select.c
+++ b/src/select.c
@@ -4239,11 +4239,13 @@ int sqlite3Select(
** and pKeyInfo to the KeyInfo structure required to navigate the
** index.
**
+ ** (2011-04-15) Do not do a full scan of an unordered index.
+ **
** In practice the KeyInfo structure will not be used. It is only
** passed to keep OP_OpenRead happy.
*/
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
- if( !pBest || pIdx->nColumn<pBest->nColumn ){
+ if( pIdx->bUnordered==0 && (!pBest || pIdx->nColumn<pBest->nColumn) ){
pBest = pIdx;
}
}