Commit Graph

19 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
dan
607dd6e608 Fix a possible NULL pointer dereference caused by using a "VALUES(...)" as a component of a compound SELECT with non-integer ORDER BY clause terms.
FossilOrigin-Name: 9d791116420f4e3f613775569e0a0cba2fc22da568b2fb2df920bcf9c9002938
2020-01-03 14:27:08 +00:00
drh
c6f36fa33a In an ORDER BY LIMIT, make sure the ORDER BY expression evaluator does not
try to reuse values from the result set if the result set has not yet
be computed.  This fixes a bug in the recent deferred-row loading 
optimization, check-in [c381f0ea57002a264fd958b28e].
OSSFuzz discovered the problem.

FossilOrigin-Name: 5d61e75f32de09c81dbe844443209f063cccb005d60b846900de5b023643fc3b
2018-05-05 16:50:35 +00:00
drh
fa16f5d9d6 Enhance EXPLAIN QUERY PLAN to report the generation of constant rows using
VALUES or just a SELECT without FROM.

FossilOrigin-Name: c75eee69fa8a9b56ee58a4cc539e80cc982f43390dc3a357344d58479dd89a41
2018-05-03 01:37:13 +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
drh
a04a8be2c2 When the [https://www.sqlite.org/queryplanner.html#partialsort|block sorting optimization]
is used in a scalar subquery, be sure to exit the loop as soon as the first
valid output row is received.  Fix for ticket [cb3aa0641d9a4].

FossilOrigin-Name: cdbb0947f9ce18d6d7e29ffab5ea6a2ee5365fbb
2016-01-13 17:50:10 +00:00
drh
11b0481778 Avoid problems when a query has a GROUP BY and an ORDER BY but no FROM clause.
FossilOrigin-Name: e527d96a1e098ade4e9d124b630a8c2ea2ac9b36
2015-04-12 01:22:04 +00:00
dan
96974bd393 Fix a problem with sorting large amounts of partially ordered data.
FossilOrigin-Name: acca97efda86a0c020854d2dd9da16f5879986b1
2015-04-11 20:20:29 +00:00
drh
137fd4fda2 Make sure that the sorting-index pre-filter recognizes that a rowid reference
might be sortable.  This fixes a performance regression.

FossilOrigin-Name: 72727b68cd07969165f1f0943cc7e1a265436653
2014-09-19 02:01:37 +00:00
drh
d0dc5d4984 Avoid closing a pseudo-table associated with sorting in a co-routine since
that pseudo-table might be used again in an outer loop.

FossilOrigin-Name: 6d81805298ea882f5fee99504d5a95f1a762a90b
2014-06-03 14:42:34 +00:00
drh
2504c6c632 Fix the query planner so that it once again knows that queries without a
FROM clause will never return more than one row and hence do not require
sorting.

FossilOrigin-Name: 9f18b303cd1bc5779d82669884f802c7889b4947
2014-06-02 11:26:33 +00:00
drh
4fe425ad79 "make test" now passing.
FossilOrigin-Name: addd7f466d6ff55f82d907286650c26b06e9397b
2013-06-12 17:08:06 +00:00
drh
aec93a1f2d Test case updates.
FossilOrigin-Name: 0360fec7c093870269211447e9642b5ee34ff778
2013-06-04 15:31:16 +00:00
drh
782d68a4cd Try to take into account the cost of inner loops when selecting which table
of a join to use for the outer loop.

FossilOrigin-Name: 942556342a332b04a11169bb04f387d741ef9488
2012-11-09 17:59:26 +00:00
drh
2fad815c52 All test cases (veryquick.tcl and min.rc) pass. A few branch operations in
ORDER BY optimization logic are untested by min.rc.

FossilOrigin-Name: 8314fd6078a3a71aea9d6386ff277cfeb592b4ba
2012-10-08 21:01:15 +00:00
drh
afcd522af8 More lenient handling of ORDER BY optimization in joins with mixed ASC/DESC.
This is a better and less restrictive fix for the problem addressed by
the previous check-in.

FossilOrigin-Name: abcf6a5d054559ee5a093ba39180c47b4958d9cd
2012-10-02 15:19:19 +00:00
drh
178eb61c6b Only continue an ORDER BY optimization into inner loops if the equality
constraints on the inner loop match terms of an outer ordered index that
are actually used by the ORDER BY clause.

FossilOrigin-Name: b0e7b4df6c2a8c479f8d210bde50c737eaa248f0
2012-10-02 14:11:29 +00:00
drh
5343b2d4a8 More test cases an bug fixes for the ORDER BY optimization of joins. All
veryquick tests now pass.

FossilOrigin-Name: 0d573320057b0903a5589cabfb1b1ece1c57958e
2012-09-27 19:53:38 +00:00
drh
6b10a6a7ed Test cases and bug fixes applied to the ORDER BY optimization for joins.
Some test cases fail, but except for the new orderby1.test failures, all
failures appear to be issues with the tests, not with the core code.

FossilOrigin-Name: 75cda864ededb6dc0f84bd52ed3311753a58e351
2012-09-27 17:31:32 +00:00