Commit Graph

30 Commits

Author SHA1 Message Date
drh 90730c9e68 When optimizing expressions of the form "x IN (SELECT ...)" make sure that
the subquery is not correlated.  Fix for ticket [5e3c886796e5512].

FossilOrigin-Name: 1ed6b06ea3c432f920fb2b66b6042be906c5d21c
2016-03-09 15:09:22 +00:00
drh 2dc292930d Fix the OR-optimization so that it always ignores subplans that do not
use an index.

FossilOrigin-Name: 66f92a16866e5825363636b9cc4b8f9b29d9e84d
2015-08-27 23:18:55 +00:00
drh a45fdc7b1e The optimization of check-in [b67a6e33f2] does not work (it generates
incorrect VDBE code) if an OR term is AND-ed with a constant expression.
So back that optimization out and add a test case to make sure it does not
get added back in.

FossilOrigin-Name: eed754fe93644f4df082eac0c0a7ffc5c78ccd10
2014-07-22 19:14:42 +00:00
drh 434a93147c Improved handling of constants and especially constant functions in the
ORDER BY clause of a query.  Do not optimize out "ORDER BY random()".
Fix for ticket [65bdeb9739605cc2296].

FossilOrigin-Name: dca1945aeb3fb005263f9be00ee8e72b966ae303
2014-02-26 02:26:09 +00:00
drh 165674d8db Fix test cases so that they work when the query planner uses index size
estimates to determine whether or not to try an covering index scan.

FossilOrigin-Name: 2f394de88f23dacd3c61e586a4214ffc6f927d97
2013-10-04 15:58:59 +00:00
dan c63e880bdb Minor fixes for test cases. No code changes.
FossilOrigin-Name: ef2a6a37366f91889dc2f1ba9cb6d1257d9b05db
2013-08-21 20:04:54 +00:00
drh aa32e3c60a Enhance the query planner so that it looks at multiple solutions to OR
expressions in the WHERE clause.

FossilOrigin-Name: 5e19d054105fb16ff52d265d48cc87a418603f6f
2013-07-16 21:31:23 +00:00
dan c1f19f95b8 Fix two test script problems revealed by permutations.test.
FossilOrigin-Name: 60cf7e44871ca8d2136ddad02188f0b9f9c380c1
2013-07-05 19:16:58 +00:00
drh 4fe425ad79 "make test" now passing.
FossilOrigin-Name: addd7f466d6ff55f82d907286650c26b06e9397b
2013-06-12 17:08:06 +00:00
drh 8a4380d761 Fixes to EXPLAIN QUERY PLAN output. Change weights back to something closer
to what they are in legacy.  More test case fixes.

FossilOrigin-Name: 36373b85f9a97840aa06e24ae31c12fcfbae084e
2013-06-11 02:32:50 +00:00
drh 7c171098b7 Remove more vestiges of sqlite_query_plan from the test cases.
FossilOrigin-Name: eb27086e8a8a4d5fcb2ea358256a555e34339423
2013-06-03 22:08:20 +00:00
drh ae70cf1816 Allow tracing of whereLoopInsert() when the 0x8 bit is set on ".wheretrace".
Remove the use of sqlite_query_plan from where2.test.  Fix a bug in the
code generator for OR clause optimizations.

FossilOrigin-Name: 707f0323264c35be14847a6adc49a0dc5eaf4ad2
2013-05-31 15:18:46 +00:00
drh 2d96b934c8 Loop through the elements on the RHS of an IN operator in reverse order when
the ORDER BY clauses specifies DESC.

FossilOrigin-Name: f78395c8896666bb1359b83fbcd58d5e3dbc39d3
2013-02-08 18:48:23 +00:00
drh 1b8fc65b92 Allow an index to be used for sorting even if prior terms of the index
are constrained by IN operators.

FossilOrigin-Name: 98bf668ab1a8683b46ee8c94cb60f8215aabc517
2013-02-07 21:15:14 +00:00
drh be837bddad Avoid assertion faults in queries using indices with redundant columns.
Ticket [3dbdcdb14e7f41].

FossilOrigin-Name: 946e06cd2a2cc209b0786b7e9d28c0746320d646
2010-04-30 21:03:24 +00:00
drh 9373b01882 Restrict the RANDOM() function to have zero arguments. Ticket #3627. (CVS 6229)
FossilOrigin-Name: b8b546b6ed799dc1621ef7b06273249af1042fb2
2009-02-02 01:50:39 +00:00
drh d1d384888b Add the experimental sqlite3_stmt_status() interface. (CVS 5781)
FossilOrigin-Name: de473efb35ffdf9a8222a70a84dfd7d3198c87c1
2008-10-07 23:46:38 +00:00
danielk1977 284f4aca32 Fix compilation/testing with OMIT_SUBQUERY defined. Ticket #2828. (CVS 4603)
FossilOrigin-Name: 0b34a18651764e650faba983be8593992ab2f4a9
2007-12-10 05:03:46 +00:00
danielk1977 4152e677b8 Fixes for compilation/testing when the various OMIT macros are defined. (CVS 4423)
FossilOrigin-Name: c8405b15c074c94dab5e33272cf1471f458d11df
2007-09-12 17:01:45 +00:00
drh 3e35580779 Disable the OR optimization if it would conflict with column
affinity coercions.  Ticket #2249.  Additional cleanup and testing
of the OR optimization. (CVS 3658)

FossilOrigin-Name: 908daaa9ab86e0bd1da6d0807d6aaba240c3cee0
2007-02-23 23:13:33 +00:00
drh 382765866b Fix a bug in the optimizer that was causing it to miss an OR optimization
opportunity. (CVS 3502)

FossilOrigin-Name: 9bf153b54c6e9ba16914dedd9e2949f32d7550ea
2006-11-06 15:10:05 +00:00
drh ffe0f8901e Correctly handle multi-column indices where multiple columns are constrained
by IN operators with subqueries on the right-hand side.  Ticket #1807. (CVS 3184)

FossilOrigin-Name: b16541ba5e6a9514f9f317888117c68b6818f9cb
2006-05-11 13:26:25 +00:00
danielk1977 3bdca9c9a5 Test suite fixes for builds that define OMIT symbols. (CVS 2962)
FossilOrigin-Name: 3a54a33dcb7e765ee3773397407e8929a8cfe1a9
2006-01-17 09:35:01 +00:00
danielk1977 ff890793fc Test file fixes for libaries compiled with various SQLITE_OMIT_ macros. (CVS 2961)
FossilOrigin-Name: c058f483a52c8043178b6329aa5e58bedf0c8277
2006-01-16 16:24:25 +00:00
danielk1977 1576cd9251 Fixes for OMIT_SUBQUERY builds: Disable where clause OR->IN optimization. Include EXISTS keyword (for new CREATE TABLE syntax). Test file fixes. (CVS 2943)
FossilOrigin-Name: 8e79a0c24a03ccf960d6ccfb7c6b9b0f7c614e9b
2006-01-14 08:02:28 +00:00
drh 8718f52624 Disable an overzealous optimization the omitted sorting on a join if the first
table gave a unique result.  The sort can only be omitted if all tables in
the join are unique.  Ticket #1358. (CVS 2589)

FossilOrigin-Name: 4f07661279fb11a06b3ddffeda672f077c0d306a
2005-08-13 16:13:04 +00:00
drh 943af3cda1 Fix problems caused by over-agressive optimization of ORDER BY in joins.
Lots more testing needed. (CVS 2571)

FossilOrigin-Name: 1a4e526d46280970b43505a5c8a4090767c63043
2005-07-29 19:43:58 +00:00
drh 6c30be8e51 Optimizer now converts OR-connected WHERE-clause terms into an IN operator so
that they can be used with indices.  There are known problems with the
ORDER BY optimization in this and in several prior check-ins.  This
check-in is not recommended for production use. (CVS 2569)

FossilOrigin-Name: d23c8bf81e508722e92ff1b9c8bc98dc026a31f2
2005-07-29 15:10:17 +00:00
drh ed37800693 The BETWEEN operator in a WHERE clause is now able to use indices. (CVS 2568)
FossilOrigin-Name: cdf8c9584b945212e065e044df801c207aedb675
2005-07-28 23:12:08 +00:00
drh a611040eea Test cases and tuning of the new optimizer code. (CVS 2567)
FossilOrigin-Name: 4b02703dec71aa78e5f8d8cab5b950966a4c6abc
2005-07-28 20:51:19 +00:00