SQLite
Check-in [04507c1763]
Not logged in
Overview
SHA1 Hash:04507c176330a06b09dcafa35ec0ca7498f5ace7
Date: 2013-01-15 16:15:28
User: drh
Comment:Clarification to a comment in where.c. No code changes.
Tags And Properties
Changes
hide diffs unified diffs patch

Changes to src/where.c

5101 ** that do not use indices. But this nRow reduction only happens if the 5101 ** that do not use indices. But this nRow reduction only happens if the 5102 ** table really is the innermost join. 5102 ** table really is the innermost join. 5103 ** 5103 ** 5104 ** The second loop iteration is only performed if no optimal scan 5104 ** The second loop iteration is only performed if no optimal scan 5105 ** strategies were found by the first iteration. This second iteration 5105 ** strategies were found by the first iteration. This second iteration 5106 ** is used to search for the lowest cost scan overall. 5106 ** is used to search for the lowest cost scan overall. 5107 ** 5107 ** 5108 ** Previous versions of SQLite performed only the second iteration - | 5108 ** Without the optimal scan step (the first iteration) a suboptimal 5109 ** the next outermost loop was always that with the lowest overall | 5109 ** plan might be chosen for queries like this: 5110 ** cost. However, this meant that SQLite could select the wrong plan < 5111 ** for scripts such as the following: < 5112 ** 5110 ** 5113 ** CREATE TABLE t1(a, b); 5111 ** CREATE TABLE t1(a, b); 5114 ** CREATE TABLE t2(c, d); 5112 ** CREATE TABLE t2(c, d); 5115 ** SELECT * FROM t2, t1 WHERE t2.rowid = t1.a; 5113 ** SELECT * FROM t2, t1 WHERE t2.rowid = t1.a; 5116 ** 5114 ** 5117 ** The best strategy is to iterate through table t1 first. However it 5115 ** The best strategy is to iterate through table t1 first. However it 5118 ** is not possible to determine this with a simple greedy algorithm. 5116 ** is not possible to determine this with a simple greedy algorithm.