]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Update ANALYZE test cases to check out the use of histograms for equality
authordrh <drh@noemail.net>
Thu, 20 Jan 2011 20:36:13 +0000 (20:36 +0000)
committerdrh <drh@noemail.net>
Thu, 20 Jan 2011 20:36:13 +0000 (20:36 +0000)
constraints.

FossilOrigin-Name: c7b59afaf0c0bf85dbaf0a122cc8d65fca93680f

manifest
manifest.uuid
test/analyze5.test

index cfa47d73c3b35f9f267d53aaea59367882df66e4..ab69287cda739795a3fb660db8a6f2296651c2d1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,8 +1,8 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-C Use\shistogram\sdata\sto\simprove\sthe\srow-count\sestimates\son\sequality\sconstraints.
-D 2011-01-20T16:52:09.439
+C Update\sANALYZE\stest\scases\sto\scheck\sout\sthe\suse\sof\shistograms\sfor\sequality\nconstraints.
+D 2011-01-20T20:36:13.223
 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
 F Makefile.in de6498556d536ae60bb8bb10e8c1ba011448658c
 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
@@ -256,7 +256,7 @@ F test/analyze.test c1eb87067fc16ece7c07e823d6395fd831b270c5
 F test/analyze2.test f45ac8d54bdad822139e53fc6307fc6b5ee41c69
 F test/analyze3.test 820ddfb7591b49607fbaf77240c7955ac3cabb04
 F test/analyze4.test 757b37875cf9bb528d46f74497bc789c88365045
-F test/analyze5.test b6bd2e4fbbe2ffcf2a22250b28fb1f2a2ca507de
+F test/analyze5.test b2139886ee199a226df8f319e37aa7bd78b8f402
 F test/async.test ad4ba51b77cd118911a3fe1356b0809da9c108c3
 F test/async2.test bf5e2ca2c96763b4cba3d016249ad7259a5603b6
 F test/async3.test 93edaa9122f498e56ea98c36c72abc407f4fb11e
@@ -900,14 +900,14 @@ F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff
 F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224
 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e
 F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
-P 2cd374cd23fa2fd38f49090d6eeb9b1e521d51d5
-R b298fdc0ea4be4264436dd1639cb2644
+P 6bfc5c69eb22938972bbf4e60179952dc215f770
+R 2f06d09a87a4d54539d7aa2af234aaef
 U drh
-Z 10e84b987d0709faa336295530a6ebae
+Z 7d948c493671d8082107f9a1879413d8
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.6 (GNU/Linux)
 
-iD8DBQFNOGg8oxKgR168RlERAhVwAJ9ZyON4XSbnksAxlSedyp9Kpxx2QACfe+y0
-6eKoyLZRueuMI2F5tREdfw4=
-=Hhmt
+iD8DBQFNOJzAoxKgR168RlERAtM4AJwMzXlyhMoDKbExZY4UcDKSjGIdkwCcDJv7
+Vr+PmfFc04BsuQfthFYbAv4=
+=9ci9
 -----END PGP SIGNATURE-----
index cbf97eefeabbdc8455e84286fabbcb770319798b..d7ce1c3e85a751a2489f38864d442b27b318f293 100644 (file)
@@ -1 +1 @@
-6bfc5c69eb22938972bbf4e60179952dc215f770
\ No newline at end of file
+c7b59afaf0c0bf85dbaf0a122cc8d65fca93680f
\ No newline at end of file
index da0dbe3eadace18a8572fa3cd9b66070c6fa1a6f..a6bf6402358acc715a0a30d5a9b086809c930ee3 100644 (file)
@@ -117,6 +117,40 @@ foreach {testid where rows} {
   } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z>? AND z<?) (~%d rows)}} \
        $rows]
 }
+foreach {testid where rows} {
+  101  {z=-1}           50
+  102  {z=0}            400
+  103  {z=1}            300
+  104  {z=2}            200
+  105  {z=3}            100
+  106  {z=4}             50
+  107  {z=-10.0}         50
+  108  {z=0.0}          400
+  109  {z=1.0}          300
+  110  {z=2.0}          200
+  111  {z=3.0}          100
+  112  {z=4.0}           50
+  113  {z=1.5}           50
+  114  {z=2.5}           50
+} {
+  do_test analyze5-1.$testid {
+    eqp "SELECT * FROM t1 WHERE $where"
+  } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z=?) (~%d rows)}} $rows]
+}
+
+# For the t1.y column, most entries are known to be zero.  So do a 
+# full table scan for y=0 but use the index for any other constraint on
+# y.
+#
+do_test analyze5-201 {
+  eqp {SELECT * FROM t1 WHERE y=0}
+} {0 0 0 {SCAN TABLE t1 (~100 rows)}}
+do_test analyze5-202 {
+  eqp {SELECT * FROM t1 WHERE y=1}
+} {0 0 0 {SEARCH TABLE t1 USING INDEX t1y (y=?) (~50 rows)}}
+do_test analyze5-203 {
+  eqp {SELECT * FROM t1 WHERE y=0.1}
+} {0 0 0 {SEARCH TABLE t1 USING INDEX t1y (y=?) (~50 rows)}}
 
 # Change the table values from integer to floating point and then
 # repeat the same sequence of tests.  We should get the same results.
@@ -180,6 +214,27 @@ foreach {testid where rows} {
   } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z>? AND z<?) (~%d rows)}} \
        $rows]
 }
+foreach {testid where rows} {
+  101  {z=-1}           50
+  102  {z=0}            400
+  103  {z=1}            300
+  104  {z=2}            200
+  105  {z=3}            100
+  106  {z=4}             50
+  107  {z=-10.0}         50
+  108  {z=0.0}          400
+  109  {z=1.0}          300
+  110  {z=2.0}          200
+  111  {z=3.0}          100
+  112  {z=4.0}           50
+  113  {z=1.5}           50
+  114  {z=2.5}           50
+} {
+  do_test analyze5-2.$testid {
+    eqp "SELECT * FROM t1 WHERE $where"
+  } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1z (z=?) (~%d rows)}} $rows]
+}
+
 
 # Repeat the same range query tests using TEXT columns.
 #
@@ -228,6 +283,20 @@ foreach {testid where rows} {
   } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1y (y>? AND y<?) (~%d rows)}} \
        $rows]
 }
+foreach {testid where rows} {
+  101  {y=0}                  50
+  102  {y='alpha'}            400
+  103  {y='bravo'}            300
+  104  {y='charlie'}          200
+  105  {y='delta'}            100
+  106  {y='echo'}             50
+  107  {y=''}                 50
+  108  {y=x'0102'}            50
+} {
+  do_test analyze5-3.$testid {
+    eqp "SELECT * FROM t1 WHERE $where"
+  } [format {0 0 0 {SEARCH TABLE t1 USING INDEX t1y (y=?) (~%d rows)}} $rows]
+}
 
 
 finish_test