SQLite

Check-in [9bbcd8c076]
Login

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

Overview
Comment:Cherrypick change [27c65d4d9c] into the 3.7.2 branch.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | branch-3.7.2
Files: files | file ages | folders
SHA1: 9bbcd8c076ce1add222da1f45ff4ee5ea2fcfc2e
User & Date: dan 2011-07-02 15:42:12.533
Context
2011-07-12
14:48
Cherrypick change [9f14fa56ba] (the fix for [54844eea3f]) from the trunk. (check-in: 7afb2354d3 user: dan tags: branch-3.7.2)
2011-07-02
15:42
Cherrypick change [27c65d4d9c] into the 3.7.2 branch. (check-in: 9bbcd8c076 user: dan tags: branch-3.7.2)
13:34
Cherrypick [45e581bff7] into the 3.7.2 branch. (check-in: c593792ce0 user: dan tags: branch-3.7.2)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/where.c.
1899
1900
1901
1902
1903
1904
1905




1906
1907
1908
1909
1910
1911
1912
  double nTableRow;           /* Rows in the input table */
  double logN;                /* log(nTableRow) */
  double costTempIdx;         /* per-query cost of the transient index */
  WhereTerm *pTerm;           /* A single term of the WHERE clause */
  WhereTerm *pWCEnd;          /* End of pWC->a[] */
  Table *pTable;              /* Table tht might be indexed */





  if( (pParse->db->flags & SQLITE_AutoIndex)==0 ){
    /* Automatic indices are disabled at run-time */
    return;
  }
  if( (pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)!=0 ){
    /* We already have some kind of index in use for this query. */
    return;







>
>
>
>







1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
  double nTableRow;           /* Rows in the input table */
  double logN;                /* log(nTableRow) */
  double costTempIdx;         /* per-query cost of the transient index */
  WhereTerm *pTerm;           /* A single term of the WHERE clause */
  WhereTerm *pWCEnd;          /* End of pWC->a[] */
  Table *pTable;              /* Table tht might be indexed */

  if( pParse->nQueryLoop<=(double)1 ){
    /* There is no point in building an automatic index for a single scan */
    return;
  }
  if( (pParse->db->flags & SQLITE_AutoIndex)==0 ){
    /* Automatic indices are disabled at run-time */
    return;
  }
  if( (pCost->plan.wsFlags & WHERE_NOT_FULLSCAN)!=0 ){
    /* We already have some kind of index in use for this query. */
    return;
Changes to test/autoindex1.test.
160
161
162
163
164
165
166









167
168
  db eval {
    EXPLAIN QUERY PLAN
    SELECT b FROM t501
     WHERE t501.a=123
       AND t501.a IN (SELECT x FROM t502 WHERE y=t501.b);
  }
} {0 0 0 {SEARCH TABLE t501 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 0 0 {SCAN TABLE t502 (~100000 rows)}}










finish_test







>
>
>
>
>
>
>
>
>


160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
  db eval {
    EXPLAIN QUERY PLAN
    SELECT b FROM t501
     WHERE t501.a=123
       AND t501.a IN (SELECT x FROM t502 WHERE y=t501.b);
  }
} {0 0 0 {SEARCH TABLE t501 USING INTEGER PRIMARY KEY (rowid=?) (~1 rows)} 0 0 0 {SCAN TABLE t502 (~100000 rows)}}


do_execsql_test autoindex1-700 {
  CREATE TABLE t5(a, b, c);
  EXPLAIN QUERY PLAN SELECT a FROM t5 WHERE b=10 ORDER BY c;
} {
  0 0 0 {SCAN TABLE t5 (~100000 rows)} 
}


finish_test