OLD | NEW |
1 # 2013 August 3 | 1 # 2013 August 3 |
2 # | 2 # |
3 # The author disclaims copyright to this source code. In place of | 3 # The author disclaims copyright to this source code. In place of |
4 # a legal notice, here is a blessing: | 4 # a legal notice, here is a blessing: |
5 # | 5 # |
6 # May you do good and not evil. | 6 # May you do good and not evil. |
7 # May you find forgiveness for yourself and forgive others. | 7 # May you find forgiveness for yourself and forgive others. |
8 # May you share freely, never taking more than you give. | 8 # May you share freely, never taking more than you give. |
9 # | 9 # |
10 #*********************************************************************** | 10 #*********************************************************************** |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 # The analyzer knows that any (z=?) expression matches 20 rows. So it | 1173 # The analyzer knows that any (z=?) expression matches 20 rows. So it |
1174 # will use index "t1z" if the estimate of hits for (x=10000 AND y<50) | 1174 # will use index "t1z" if the estimate of hits for (x=10000 AND y<50) |
1175 # is greater than 20 rows. | 1175 # is greater than 20 rows. |
1176 # | 1176 # |
1177 # And it should be. The analyzer has a stat4 sample as follows: | 1177 # And it should be. The analyzer has a stat4 sample as follows: |
1178 # | 1178 # |
1179 # sample=(x=10000, y=100) nLt=(10000 10099) | 1179 # sample=(x=10000, y=100) nLt=(10000 10099) |
1180 # | 1180 # |
1181 # There should be no other samples that start with (x=10000). So it knows | 1181 # There should be no other samples that start with (x=10000). So it knows |
1182 # that (x=10000 AND y<50) must match somewhere between 0 and 99 rows, but | 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 # At one point though, due to a problem in whereKeyStats(), the planner was | 1185 # At one point though, due to a problem in whereKeyStats(), the planner was |
1186 # estimating that (x=10000 AND y<50) would match only 2 rows. | 1186 # estimating that (x=10000 AND y<50) would match only 2 rows. |
1187 # | 1187 # |
1188 do_eqp_test 26.1.4 { | 1188 do_eqp_test 26.1.4 { |
1189 SELECT * FROM t1 WHERE x = 10000 AND y < 50 AND z = 444; | 1189 SELECT * FROM t1 WHERE x = 10000 AND y < 50 AND z = 444; |
1190 } { | 1190 } { |
1191 0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z=?)} | 1191 0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z=?)} |
1192 } | 1192 } |
1193 | 1193 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 } | 1237 } |
1238 | 1238 |
1239 do_eqp_test 26.2.2 { | 1239 do_eqp_test 26.2.2 { |
1240 SELECT * FROM t1 WHERE x='B' AND y>25 AND z=?; | 1240 SELECT * FROM t1 WHERE x='B' AND y>25 AND z=?; |
1241 } { | 1241 } { |
1242 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (x=? AND y>?)} | 1242 0 0 0 {SEARCH TABLE t1 USING INDEX i1 (x=? AND y>?)} |
1243 } | 1243 } |
1244 | 1244 |
1245 | 1245 |
1246 finish_test | 1246 finish_test |
1247 | |
1248 | |
1249 | |
OLD | NEW |