Commit Graph

32 Commits

Author SHA1 Message Date
drh
8210233c7b Revise tests cases to align with the new EXPLAIN QUERY PLAN output.
FossilOrigin-Name: 50fbd532602d2c316813046ed6be8be2991c281eb5f295c4c28520a0de73862c
2021-03-20 15:11:29 +00:00
drh
094afffaec Improve the query planner so that it is better able to find full
index scan plan when there is an INDEXED BY clause.

FossilOrigin-Name: d901837fea1ed54de43ad59eb47c02cbfd2eb215fc57317b5ea8c22a7df947c4
2020-06-03 03:00:09 +00:00
drh
175b8f06f7 Remove support for STAT3. The sqlite_stat3 tables are ignored, if they
exist.  STAT4 continues to work as it always has, and as it is a superset of
STAT3 is the recommended replacement.

FossilOrigin-Name: 1e17ea2fd1df4ad49138c787c8fe3207dd0c25c93f9001d52a9b69f8c12e841c
2019-08-08 15:24:17 +00:00
drh
bd462bcc10 Improvements to EXPLAIN QUERY PLAN formatting. The MULTI-INDEX OR now shows
a separate "INDEX" subtree for each index.  SCALAR SUBQUERY entries provide
a subquery number that is related back to the .selecttrace output.

FossilOrigin-Name: 7153552bac51295c56a1c42ca79d57195851e232509f9e9610375692f48c7e86
2018-12-24 20:21:06 +00:00
drh
5d72d9245d Make a separate limb in the EXPLAIN QUERY PLAN output for the various lines
associated with the OR-optimization.

FossilOrigin-Name: 75ac7b4e4fd0811ca80c719badacff207e0bbd00ac64dde3b3d4ec676fad472d
2018-05-04 00:39:43 +00:00
drh
b3f0276b9e Fix test cases so that they work with the new EXPLAIN QUERY PLAN output
format.  Only some of the cases have been fixed.  This is an incremental
check-in.

FossilOrigin-Name: 5f0e803e33aa557865d5fc830d9202d628de9a94c9757058ca48f1a560702cd3
2018-05-02 18:00:17 +00:00
dan
299b24688a Fix where9.test so that it works with the "no_optimization" permutation.
FossilOrigin-Name: d46adf9d8f741838b9c30f915231d6a3986c3591
2014-08-12 20:13:22 +00:00
drh
d41d39f24d In the query optimizer, when converting BETWEEN and LIKE/GLOB expressions
into simpler forms for processing, be sure to transfer the LEFT JOIN markings.
Fix for ticket [bc878246eafe0f52c].

FossilOrigin-Name: caab361ebee5f5c3fdafd9b1abe3d1ab7c5b4db9
2013-08-28 16:27:01 +00:00
dan
8ad169abb4 If ENABLE_STAT3 is defined but ENABLE_STAT4 is not, have ANALYZE create and populate the sqlite_stat3 table instead of sqlite_stat4.
FossilOrigin-Name: cca8bf4372ab7a0258aa5c9397818415c6cf0abf
2013-08-12 20:14:04 +00:00
dan
f52bb8d385 Begin adding experimental sqlite_stat4 table. This commit is buggy.
FossilOrigin-Name: 2beea303a1d609cd2ff252412c50b966b9e5e8f1
2013-08-03 20:24:58 +00:00
drh
74f91d4462 Add in the cost of doing a table lookup on OR searches. Make test case
changes to deal with difference in STAT3 behavior.

FossilOrigin-Name: d97898e8e3990ae8c1882c9102b57692d8810730
2013-06-19 18:01:44 +00:00
drh
fd5874d23d Add the "queryplanner" test permutation. Continuing refinements to NGQP.
FossilOrigin-Name: 25e2cde105a19293bdb9c001b48624e5d7f8c4e5
2013-06-12 14:52:39 +00:00
drh
5822d6feb2 Fix test cases for the new EXPLAIN QUERY PLAN format. Add the
wherecosttest tool.  Other fixes to logarithm cost.

FossilOrigin-Name: aa580e368e3c398b8377b80342dfdd906324c248
2013-06-10 23:30:09 +00:00
drh
b3129fa560 Do not move WHERE clause terms inside OR expressions that are contained
within an ON clause of a LEFT JOIN.  Fix for ticket [f2369304e47167e3e].

FossilOrigin-Name: 1128575d0ab24f7023a0f6e6ce4828b9a09a7c6c
2013-05-09 14:20:11 +00:00
drh
832ee3d4cc Optimize the degenerate case of a FROM clause table name enclosed all by
itself inside parentheses.  Generate code as if the parentheses did not
exist, rather than the old behavior of manifesting the parenthesized table
into a transient table.  Also, tag every FROM-clause SELECT subquery that is
generated by a parenthesized FROM-clause expression using the SF_NestedFrom
flag.  The new SF_NestedFrom flag is not yet used for anything.

FossilOrigin-Name: 7fecced466d86a66b0b751c5b5608141e134fe2d
2012-12-18 19:36:11 +00:00
drh
3f4d1d1b02 Attempt to use a covering index even on a full table scan, under the theory
that the index will be smaller and require less disk I/O and thus be faster.

FossilOrigin-Name: cfaa7bc12847a7006ccc93815f2395ad5259744a
2012-09-15 18:45:54 +00:00
drh
331b67c151 Candidate fix for the optimizer problem described in ticket
[b7c8682cc17f3] which can causes a LEFT JOIN to be changed
into a INNER JOIN if there are OR terms in the WHERE clause.

FossilOrigin-Name: 0dc4cb935514131c99172175d57feec3a1743aa9
2012-03-09 22:02:08 +00:00
dan
2f56da3f26 Changes to various test scripts so that veryquick.test runs with OMIT_COMPOUND_SELECT defined.
FossilOrigin-Name: 76bb649ee2633226324130f5898622c348f93769
2012-02-13 10:00:35 +00:00
drh
85ae206e69 More test cases for the OR optimization.
FossilOrigin-Name: 4997d8b81cd3ea7c708911bfece00020d11224f9
2011-10-07 16:08:28 +00:00
drh
083310dfcc Change the weighting of binary searches on tables to 1/10th the cost of a
search on an index.  Change the assumed reduction in search space from a
indexed range constraint from 1/3rd to 1/4th.  Do not let the estimated 
number of rows drop below 1.

FossilOrigin-Name: 4847c6cb71423248b186ab7842b97c83e2f5fefd
2011-01-28 01:57:41 +00:00
dan
4bc39fa188 Change the EXPLAIN QUERY PLAN output to use "USING INDEX" instead of "BY INDEX", and to use "SEARCH" instead of "SCAN" for loops that are not full-table scans.
FossilOrigin-Name: 6611b76b0296875fb9903b25dfaa783a9c12eaa1
2010-11-13 16:42:27 +00:00
dan
acf1987d18 Fix a bug in the EXPLAIN QUERY PLAN code.
FossilOrigin-Name: 7ae068952fba4395b4aa437613a5ed2bd9ddf941
2010-11-11 11:43:01 +00:00
dan
47eb16d4ce Modifications to test cases to account for new EXPLAIN QUERY PLAN output.
FossilOrigin-Name: 30904ef8412348464e893e9e1551ef22cad24a3e
2010-11-11 10:36:25 +00:00
drh
dda70fe38e Remove leftover "breakpoint" commands from test scripts. Also remove blank
lines at the end of scripts. (CVS 6721)

FossilOrigin-Name: 1fef16ec2b89981770cf44f606a420fbe031a7a4
2009-06-05 17:09:11 +00:00
danielk1977
1d46146b58 Attempt to optimize virtual table queries with 'OR' expressions in the WHERE clause. (CVS 6527)
FossilOrigin-Name: f61e4cd93682fd98bea2a71d346f9eaa68454390
2009-04-21 09:02:45 +00:00
danielk1977
a55331620e Optimize queries of the form "SELECT count(*) FROM <tbl>" by adding a sqlite3BtreeCount() interface to the btree layer. (CVS 6316)
FossilOrigin-Name: d4aa6593183224b6868a322511511c0bbf63b598
2009-02-24 10:01:51 +00:00
danielk1977
e2d7b24d08 Scan an index instead of a table for "SELECT count(*) FROM <tbl>" queries. Because an index is usually smaller than a table on disk, this saves some IO. (CVS 6315)
FossilOrigin-Name: 294ba6f743c9132dce0e73da480bd3c2071e7239
2009-02-23 17:33:49 +00:00
drh
103bd88cf7 Increased test coverage in where.c. (CVS 6146)
FossilOrigin-Name: 1e5725c5179660277c2e8c321877d7ee3ca21808
2009-01-08 21:00:02 +00:00
drh
171256c45c Increase test coverage of where.c. Make sure OR-optimization works on
UPDATE and DELETE in addition to SELECT.  (Bug found by coverage tests.) (CVS 6139)

FossilOrigin-Name: 4b2c08e8984befb12fa2173ca89d9f54cf764d22
2009-01-08 03:11:19 +00:00
drh
04bbcd5ce9 Fix a bug in the multi-index OR cost estimator. Remove leftover "breakpoint"
commands from test scripts. (CVS 6086)

FossilOrigin-Name: b090d5736d7eaec17a39d3133e1587b1d2a42acb
2008-12-30 17:55:00 +00:00
drh
eb9441eb06 Add LEFT JOIN test cases for multi-index OR in where9.test. (CVS 6085)
FossilOrigin-Name: 96f3b62914adde34079f08428b4e2fe81c193612
2008-12-30 16:35:53 +00:00
drh
46129af9fb Get EXPLAIN QUERY PLAN working with the multi-index OR optimization.
Added new test script "where9.test". (CVS 6084)

FossilOrigin-Name: 4b6460221011e02bedb724169e8e4793e539e65a
2008-12-30 16:18:47 +00:00