Index: src/where.c ================================================================== --- src/where.c +++ src/where.c @@ -1559,11 +1559,12 @@ if( rc!=SQLITE_OK ) return rc; if( bOk==0 ) return SQLITE_NOTFOUND; pBuilder->nRecValid = nEq; whereKeyStats(pParse, p, pRec, 0, a); - WHERETRACE(0x10,("equality scan regions: %d\n", (int)a[1])); + WHERETRACE(0x10,("equality scan regions %s(%d): %d\n", + p->zName, nEq-1, (int)a[1])); *pnRow = a[1]; return rc; } #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ Index: test/analyze9.test ================================================================== --- test/analyze9.test +++ test/analyze9.test @@ -1178,11 +1178,11 @@ # # sample=(x=10000, y=100) nLt=(10000 10099) # # There should be no other samples that start with (x=10000). So it knows # that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but -# know more than that. Guessing less than 20 is therefore unreasonable. +# no more than that. Guessing less than 20 is therefore unreasonable. # # At one point though, due to a problem in whereKeyStats(), the planner was # estimating that (x=10000 AND y<50) would match only 2 rows. # do_eqp_test 26.1.4 { Index: test/analyzeD.test ================================================================== --- test/analyzeD.test +++ test/analyzeD.test @@ -1,6 +1,6 @@ -# 2005 July 22 +# 2014-10-04 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. @@ -9,11 +9,10 @@ # #*********************************************************************** # This file implements regression tests for SQLite library. # This file implements tests for the ANALYZE command. # -# $Id: analyze.test,v 1.9 2008/08/11 18:44:58 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl set ::testprefix analyzeD @@ -73,11 +72,11 @@ db close sqlite3 db test.db } {} # Without stat1, because 3001 is larger than all samples in the stat4 -# table, SQLite things that a=3001 matches just 1 row. So it (incorrectly) +# table, SQLite thinks that a=3001 matches just 1 row. So it (incorrectly) # chooses it over the c=150 index (5 rows). Even with stat1 data, things # worked this way before commit [e6f7f97dbc]. # do_eqp_test 1.4 { SELECT * FROM t1 WHERE a=3001 AND c=150;