/ Check-in [13a37fd4]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Improved debugging output with wheretrace. Fix some typos in test script comments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 13a37fd487ce7d4f98a12f7a67a9c05dadc66557
User & Date: drh 2016-03-01 22:41:27
Context
2016-03-01
22:48
New test cases and infrastructure for testing the xBestIndex method of virtual tables. check-in: 1d41c161 user: drh tags: trunk
22:41
Improved debugging output with wheretrace. Fix some typos in test script comments. check-in: 13a37fd4 user: drh tags: trunk
02:11
Better estimatedCost in the xBestIndex method of the generate_series vtab. check-in: f2c16094 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/where.c.

  1557   1557     rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq-1, &bOk);
  1558   1558     pBuilder->pRec = pRec;
  1559   1559     if( rc!=SQLITE_OK ) return rc;
  1560   1560     if( bOk==0 ) return SQLITE_NOTFOUND;
  1561   1561     pBuilder->nRecValid = nEq;
  1562   1562   
  1563   1563     whereKeyStats(pParse, p, pRec, 0, a);
  1564         -  WHERETRACE(0x10,("equality scan regions: %d\n", (int)a[1]));
         1564  +  WHERETRACE(0x10,("equality scan regions %s(%d): %d\n",
         1565  +                   p->zName, nEq-1, (int)a[1]));
  1565   1566     *pnRow = a[1];
  1566   1567     
  1567   1568     return rc;
  1568   1569   }
  1569   1570   #endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */
  1570   1571   
  1571   1572   #ifdef SQLITE_ENABLE_STAT3_OR_STAT4

Changes to test/analyze9.test.

  1176   1176   #
  1177   1177   # And it should be. The analyzer has a stat4 sample as follows:
  1178   1178   #
  1179   1179   #   sample=(x=10000, y=100) nLt=(10000 10099)
  1180   1180   #
  1181   1181   # There should be no other samples that start with (x=10000). So it knows 
  1182   1182   # that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but
  1183         -# know more than that. Guessing less than 20 is therefore unreasonable.
         1183  +# no more than that. Guessing less than 20 is therefore unreasonable.
  1184   1184   #
  1185   1185   # At one point though, due to a problem in whereKeyStats(), the planner was
  1186   1186   # estimating that (x=10000 AND y<50) would match only 2 rows.
  1187   1187   #
  1188   1188   do_eqp_test 26.1.4 {
  1189   1189     SELECT * FROM t1 WHERE x = 10000 AND y < 50 AND z = 444;
  1190   1190   } {

Changes to test/analyzeD.test.

     1         -# 2005 July 22
            1  +# 2014-10-04
     2      2   #
     3      3   # The author disclaims copyright to this source code.  In place of
     4      4   # a legal notice, here is a blessing:
     5      5   #
     6      6   #    May you do good and not evil.
     7      7   #    May you find forgiveness for yourself and forgive others.
     8      8   #    May you share freely, never taking more than you give.
     9      9   #
    10     10   #***********************************************************************
    11     11   # This file implements regression tests for SQLite library.
    12     12   # This file implements tests for the ANALYZE command.
    13     13   #
    14         -# $Id: analyze.test,v 1.9 2008/08/11 18:44:58 drh Exp $
    15     14   
    16     15   set testdir [file dirname $argv0]
    17     16   source $testdir/tester.tcl
    18     17   set ::testprefix analyzeD
    19     18   
    20     19   ifcapable {!stat4} {
    21     20     finish_test
................................................................................
    71     70   do_test 1.3 {
    72     71     execsql { DELETE FROM sqlite_stat1 }
    73     72     db close
    74     73     sqlite3 db test.db
    75     74   } {}
    76     75   
    77     76   # Without stat1, because 3001 is larger than all samples in the stat4
    78         -# table, SQLite things that a=3001 matches just 1 row. So it (incorrectly)
           77  +# table, SQLite thinks that a=3001 matches just 1 row. So it (incorrectly)
    79     78   # chooses it over the c=150 index (5 rows). Even with stat1 data, things
    80     79   # worked this way before commit [e6f7f97dbc].
    81     80   #
    82     81   do_eqp_test 1.4 {
    83     82     SELECT * FROM t1 WHERE a=3001 AND c=150;
    84     83   } {
    85     84     0 0 0 {SEARCH TABLE t1 USING INDEX t1_ab (a=?)}