drh
7ba39a921a
Cut over the NGQP query planner. Remove lots of legacy code.
...
This check-in compiles but does not work. The test suite gets incorrect
answers and crashes.
FossilOrigin-Name: 001539df4b74dc1cbceb010a91407003ab4d8735
2013-05-30 17:43:19 +00:00
drh
88da644f2c
Update the NGQP to record which loops need be run in reverse order to
...
satisfy ORDER BY clauses.
FossilOrigin-Name: 211f7a5374fe20a02535edc8b799a8a7136ff6b3
2013-05-27 17:59:37 +00:00
drh
3bd26f0543
Record in the WhereLoop object the set of virtual table constraints that
...
need not be separately checked.
FossilOrigin-Name: b49fa74561f38c945be6149693678fd6518c2de4
2013-05-24 14:52:03 +00:00
drh
ef86637655
Use the NGQP plan for EXPLAIN QUERY PLAN output. This change causes 207
...
errors in veryquick.test, many of which are benign.
FossilOrigin-Name: f783e8e6b10de44029c7c5f57e4648a4a677ca1b
2013-05-22 20:49:02 +00:00
drh
0f133a4832
Allow the rowid at the end of an index to be used in a constraint on that index.
...
FossilOrigin-Name: 9bf0524df7ca2e7fcd92b2878a8457264b3c7f6e
2013-05-22 17:01:17 +00:00
drh
a50ef114f4
Improvements to ORDER BY handling in the NGQP. Fix an "exit" mistakenly
...
left in a test script during the previous check-in.
FossilOrigin-Name: 12c709b4369c7d94d7fb743d0d0da7a9350a3d16
2013-05-22 02:06:59 +00:00
drh
d15cb17174
Enhanced "wheretrace" output in the NGQP solver routine.
...
FossilOrigin-Name: 04dfb85a2a7025d4b5056b73fa8477691323919f
2013-05-21 19:23:10 +00:00
drh
23f98daabb
Work toward improving the NGQP's ability to optimize out ORDER BY clauses.
...
FossilOrigin-Name: 67367f1e1f0c3eb6be65eea9873910aa62b49884
2013-05-21 15:52:07 +00:00
drh
319f677d57
First attempt to get ORDER BY optimization working in NGQP.
...
FossilOrigin-Name: 9fe20292558bb9422de91e35648cb834cbf3b306
2013-05-14 15:31:07 +00:00
drh
0823c89c9b
Minor fixes to the OR-clause processing in the NGQP.
...
FossilOrigin-Name: d6946f33c7851aa7efb04b93ac2ae1ac50c26eec
2013-05-11 00:06:23 +00:00
drh
cf8fa7a65b
Now generating OR-clause plans.
...
FossilOrigin-Name: e17003fcfec0c0b524b1b9ff8e15e7ee83efa571
2013-05-10 20:26:22 +00:00
drh
eb04de3224
Update the NGQP so that it can produce plans that include automatic indices.
...
FossilOrigin-Name: 586b55d8d7722de1c0530b3b832bae0511e6d05c
2013-05-10 15:16:30 +00:00
drh
b2a90f09b8
Factor out common operations into whereLoopAddAll(). Add stubs for
...
missing features.
FossilOrigin-Name: 0278e420614e02fb2d8474ed99b0904275882dfe
2013-05-10 03:30:49 +00:00
drh
2b344c7220
Merge in the latest trunk changes.
...
FossilOrigin-Name: 5ed31c8279a4f465b982df5dc20cefc286928b93
2013-05-10 02:11:40 +00:00
drh
6b7157bbd5
Free up bits of wsFlags for reuse. Install the ORDER BY optimization
...
infrastructure for the NGQP.
FossilOrigin-Name: 82d50e198025a2fdb8ee733edb8419d388ee5362
2013-05-10 02:00:35 +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
c718f1c894
Fix memory leaks in the NGQP logic for virtual tables.
...
FossilOrigin-Name: 3c2e83a4a2c5e85202162feeb37ef7a3911c05a3
2013-05-08 20:05:58 +00:00
drh
5346e95dda
NGQP working with virtualt tables, though many legacy tests fail and there
...
are yet some memory leaks.
FossilOrigin-Name: bd9327a9684b99978734ccd561eea1ad864ab13b
2013-05-08 14:14:26 +00:00
drh
a184fb87b8
More bug fixes to the WhereLoop generator and the solver in NGQP.
...
Now finds the best plan for TPC-H Q8. This seems to prove the
concept, but there is still much work to be done.
FossilOrigin-Name: 8e5aad37529ec3042e3468acf15186f566e2df8a
2013-05-08 04:22:59 +00:00
drh
f204dac1e3
Bug fixes in the solver.
...
FossilOrigin-Name: b36034bbd19bc5677b26a6f60ca96eb2b37db373
2013-05-08 03:22:07 +00:00
drh
a18f3d271e
Add the NGQP solver.
...
FossilOrigin-Name: 5d37587c50d8932b6357bfd03152a851510a4317
2013-05-08 03:05:41 +00:00
drh
43fe25fcef
Continued progress on generating good WhereLoop objects for the new query
...
planner.
FossilOrigin-Name: 15cc8a16482777d8e138c4d0863faf8d54fef33a
2013-05-07 23:06:23 +00:00
drh
f1645f0843
Inserting a few WhereLoop objects without leaking memory. Costs are
...
not correct. Inequality and IN constraints are not implemented.
FossilOrigin-Name: e8881a8b2f25f38bc8ff77619f96f38fe530d13b
2013-05-07 19:44:38 +00:00
drh
1c8148fffb
In where.c, make findTerm() a wrapper around methods to a new WhereScan object
...
which is capable of finding all suitable matching terms, not just the first.
This check-in includes some prototype functions for building WhereLoop objects.
FossilOrigin-Name: dd92b8fa929badaf2f79e8a00c83667a9d589096
2013-05-04 20:25:23 +00:00
drh
f1b5f5b855
Begin inserting some experimental code for the next generation query planner.
...
FossilOrigin-Name: ccaf4c3f7e1ec45e058d594d9b5c26818a37722a
2013-05-02 00:15:01 +00:00
drh
a309552e2c
Do not use a transitive constraint to an IN operator where the RHS is a
...
constant if there exists a direct == operator to another table in an outer
loop.
FossilOrigin-Name: faedaeace9c7ed9a8aaf96700caee09db0c0c061
2013-05-01 17:58:35 +00:00
drh
5c10f3b38e
Avoid redundant constraint checking due to transitive constraints.
...
FossilOrigin-Name: 329478cbed06f93652de50abdb31a6b41af02b9e
2013-05-01 17:22:38 +00:00
drh
d99aaf10df
Do not allow a virtual table to cancel the ORDER BY clause unless all
...
outer loops are guaranteed to return no more than one row result.
Candidate fix for ticket [ba82a4a41eac1].
FossilOrigin-Name: 49cfa14fceeef2d55b449eb927c283ce6f650c07
2013-04-22 19:56:12 +00:00
drh
0c41d22920
Use transitivity to move constraints into the outer loops of a join whenever
...
possible, thereby reducing the amount of work that needs to occur in
inner loops.
FossilOrigin-Name: 5f4907e1c6230e3dd904bd99e1c48c576c669f63
2013-04-22 02:39:10 +00:00
drh
83b5bfc7d3
Do not suppress the ORDER BY clause on a virtual table query if an IN
...
constraint is used. Fix for ticket [f69b96e3076e]. Testing done on
TH3 using cov1/where37.test.
FossilOrigin-Name: 61b2a7be3b9c04bf45bffa93a7d3a480fc5c947a
2013-04-18 02:55:54 +00:00
drh
d9883570f5
In order to optimize out the ORDER BY clause,
...
outer loops must generate values for ORDER BY terms that are unique or else
the inner loops must generate no more than a single row.
Fix for ticket [a179fe7465].
FossilOrigin-Name: 2936f7466e162dfb003bda26d35358d1b3063112
2013-03-27 17:20:10 +00:00
drh
e6a8bbbb62
Restore additional ORDER BY optimizations that where broken by the
...
recent ORDER BY fix.
FossilOrigin-Name: c77ee6e20d3a8c91a8bf4c9063c36a95c70e17cf
2013-03-27 16:42:21 +00:00
drh
2b6c874b13
Improved optimization of ORDER BY.
...
FossilOrigin-Name: 97e5c70f2f19a1bca70dd2221b757b9e5418fce0
2013-03-27 16:05:30 +00:00
drh
8a1b87cb97
A fix an test-case for the ORDER BY problem identified by ticket [a179fe7465].
...
This change causes sorting to occur in some cases where it is not strictly
necessary. Further work is needed to avoid those extra sorts.
FossilOrigin-Name: 488089e615e375c01b31544f06e801af950ae3db
2013-03-27 15:04:28 +00:00
mistachkin
48864df97d
Many spelling fixes in comments. No changes to code.
...
FossilOrigin-Name: 6f6e2d50941e444ebc83604daddcc034137a05b7
2013-03-21 21:20:32 +00:00
drh
725e1ae52e
Add a single new test case to the ORDER BY with IN logic verify that if the
...
RHS of the IN is a descending index that it still works. Add testcase()
macros to the ORDER BY with IN logic to help verify that corner cases are
tested.
FossilOrigin-Name: 7e7356f1552cd53ea363d1ded3b2c221c9d0be01
2013-03-12 23:58:42 +00:00
drh
1ccce44937
Fix the ORDER BY optimization with IN constraints when the RHS of the
...
IN constraint is a descending index.
FossilOrigin-Name: 62316ebaca933f7e5df2018e8360a2b74234f30a
2013-03-12 20:38:51 +00:00
drh
d383216383
Revise the patch to make it easier to understand.
...
FossilOrigin-Name: 3ce7eb0265b5be4e23264ae41332b947011ff1ad
2013-03-12 18:49:25 +00:00
drh
7a3e147ee2
Revised fix for the DESC ORDER BY and IN constraint bug,
...
ticket [4dd95f6943fbd18]. The previous check-in was incorrect.
FossilOrigin-Name: 8b2eb7a43b4580f04c14ea8600cf080e0e7f384d
2013-03-12 18:40:20 +00:00
drh
0fe456bb29
A proposed fix for the DESC ORDER BY bug of ticket [4dd95f6943fbd18].
...
Seems to work, but lots more testing is needed prior to moving to trunk.
FossilOrigin-Name: 614a038ad2fe111687d2bc1c0aa716d7eb8fdd7c
2013-03-12 18:34:50 +00:00
drh
459f63e7ed
Fix a bug (ticket [fc7bd6358f59]) that caused incorrect query results in
...
three way queries that involved comparing INTEGER and TEXT columns for
equality.
FossilOrigin-Name: 7097241c1220ada318f8eda938c3e3430b94a606
2013-03-06 01:55:27 +00:00
drh
5edf8435d3
Fix a potential NULL-pointer dereference following an OOM error
...
in the query planner logic for virtual tables with OR-connected terms.
FossilOrigin-Name: 71b6c26053fdf2a5a84116e005bad1f2ca873a66
2013-02-08 23:18:18 +00:00
drh
3667033bfc
Make sure the virtual tables that take advantage of IN operators sort the
...
RHS of the IN operator in the correct order according to the ORDER BY
clause.
FossilOrigin-Name: b016b7546d6fbfba06019398b9ac239b0cbe9086
2013-02-08 20:39:02 +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
c3e552ff5c
Allow the "a=?1 OR a=?2" to "a IN (?1,?2)" transformation to work on virtual
...
tables again. This was formerly restricted because virtual tables could not
optimize IN terms. (See check-in [fad88e71cf195e].) But IN terms are now
used by virtual tables (as of check-in [3d65c70343]) so the restriction can
now be removed.
FossilOrigin-Name: a917c1f09254b54e03e31b119cc49c551269d82e
2013-02-08 16:04:19 +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
928d9c6209
Fix harmless compiler warnings.
...
FossilOrigin-Name: 4a7b4ee011fea911b981206c242e3d5553303b52
2013-02-07 09:33:56 +00:00
drh
eb5bc9261c
Add the ability to disable transitive constraints using the
...
sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS) interface.
FossilOrigin-Name: 593d67c8b0908daf7a70b2a310ed85515d384cbf
2013-01-17 16:43:33 +00:00
drh
63db0392ae
Avoid unnecessary collating sequence and affinity restrictions on the use
...
of transitivity. Add test cases to show that the restrictions are not
needed.
FossilOrigin-Name: 56549f45666b53876012df5c2bdf813474e10925
2013-01-17 16:18:55 +00:00
drh
738fc79dcf
Make more aggressive use of transitivity in optimizing queries. Add a test
...
case.
FossilOrigin-Name: d96762841a461e192fb2f317d684d000376350dd
2013-01-17 15:05:17 +00:00