Commit Graph

69 Commits

Author SHA1 Message Date
drh c9eaeef1fe Remove a debuggin "exit" command mistakenly left in the "where.test" module.
FossilOrigin-Name: beda0b8c76c2c7328a44156257c978cf8f5df59b
2016-02-26 04:04:07 +00:00
drh 8c098e61b6 Fix an incorrect cost computation for sorting (introduced just a few
check-ins ago).  Should be NlogN, not NloglogN.

FossilOrigin-Name: 2459d3238853951bc3a507dd975e7ec921cf8446
2016-02-25 23:21:41 +00:00
drh b1d607de25 Improvements and simplifications to the equality seek logic. Tests are
adjusted so that they all pass now.

FossilOrigin-Name: 997ce6c90b454c03cc2ef6934752ee8dd2e520e3
2015-11-05 22:30:54 +00:00
drh edb04ed946 Continue to support the (broken) legacy syntax of allowing strings for
column names in CREATE INDEX statements and in UNIQUE and PRIMARY KEY
constraints.

FossilOrigin-Name: 3d3df79bfaf9dbc7aa711c08a19d2f6dbe744b32
2015-09-04 12:54:01 +00:00
drh e0cc3c296c Add testcase() macros and comments and a few test-cases.
FossilOrigin-Name: 24263d08b11c88416d270013bdaf5ff45125cb4d
2015-05-13 17:54:08 +00:00
drh cfc6ca4179 Seek past NULLs in a top-constrained search. Avoid checking for NULLs in
the body of the search.

FossilOrigin-Name: e07a32f30862acf3b322d4d8deb015846d6f8f5f
2014-02-14 23:49:13 +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
drh 67a5ec7b54 Make sure the omit-noop-left-join optimization is not applied if columns
of the LEFT JOIN are used in the ORDER BY clause.  
Ticket [be84e357c035]

FossilOrigin-Name: 0303d6bc7112e6f810ae1bd75cafc5ffc51f5212
2013-09-03 14:03:47 +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 6fa978dade Futher simplifications to the NGQP. Fix some test cases to use
EXPLAIN QUERY PLAN rather than the (now obsolete) sqlite_query_plan
global variable.

FossilOrigin-Name: ae985db4fa08b5efbef5a834e852f0b05101264b
2013-05-30 19:29:19 +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
dan e825831ee4 Disable a couple of tests in where.test when running the "no_optimization" permutation.
FossilOrigin-Name: 5e961e37c5357776bcb44c473cb5ee4b59561f07
2012-12-05 19:04:32 +00:00
drh 6f0e400cba Fix a query planner problem that only occurs when covering-index-scan is
disabled.  Fix to tests whose output changed due to the new and more
aggressive ORDER BY optimization.

FossilOrigin-Name: 0f9bb90100aa304a7f28023ca4173e68b445e8bd
2012-10-03 12:38:19 +00:00
drh a9e3fc05f5 Fix some corner case behavior in the new ORDER BY optimization logic.
Remove the SQLITE_OrderByIdx bit from the 
SQLITE_TESTCTRL_OPTIMIZATIONS mask, since enabling it caused many
TH3 tests to fail when the NO_OPT configuration parameter was engaged,
and since there really isn't any need to turn that optimization off.
The SQLITE_OrderByIdxJoin bit remains.

FossilOrigin-Name: 98b633717a1c9a08f6a1d00bc6bc891564ae7e9b
2012-09-27 23:27:23 +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 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
dan 99f8fb66a4 Fix for 2a5629202f. When considering whether or not a UNIQUE index may be used to optimize an ORDER BY clause, do not assume that all index entries are distinct unless there is some reason to believe that the index contains no NULL values.
FossilOrigin-Name: 9870e4c4fef10112c987c40cb1b95255a7214202
2012-04-20 15:24:53 +00:00
danielk1977 3072c5ea11 Fix a bug reported on the mailing list triggered by the pattern "SELECT <col>, (SELECT ... FROM tbl WHERE rowid > <col>) FROM ...". (CVS 5855)
FossilOrigin-Name: 6c918c4eb9362ebfdbe0486515679102b2862970
2008-11-03 09:06:05 +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 2d60549926 Fix a bug in where.c where a non-temp register was being incorrectly deallocated. Ticket #3408. (CVS 5758)
FossilOrigin-Name: 59d2e89e2181c26b18eac68ccc80ea3018f70a5e
2008-10-01 08:43:03 +00:00
drh 588a9a1a1c Defer deleting Table objects associated with flattened subqueries until
all code has been generated, in case some expression node still references
the Table object.  Ticket #3346. (CVS 5650)

FossilOrigin-Name: d04d70336727a0db959c672e6c22cdaa0505dce5
2008-09-01 15:52:10 +00:00
drh 85e9e22b33 Increased test coverage. (CVS 5414)
FossilOrigin-Name: 7cf91e08c08ce515c24c738c7d079f5b81eebee6
2008-07-15 00:27:34 +00:00
drh e8f52c5089 Remove leftover debugging commands (breakpoint and btree_breakpoint) from
test scripts. (CVS 5400)

FossilOrigin-Name: dcb160249fa2d592ad09b8b0052102dc44a93511
2008-07-12 14:52:20 +00:00
danielk1977 21de2e755c When using an index to scan a database table, read column data from the index in preference to the table. This increases the likelihood that the table will not be required at all. (CVS 4580)
FossilOrigin-Name: 061608c72ac0a96eacf3b64d638235e4739f96ba
2007-11-29 17:43:27 +00:00
danielk1977 c9cf6e3d31 Fix for #2445. A bug in the lookupName() logic that could cause a crash when a WHERE clause used an alias to refer to an expression in the result-set of the SELECT, and that expression was itself a reference to a table column. (CVS 4122)
FossilOrigin-Name: 044ca1c72a8f4632dc2e6a94690d164d3560ee38
2007-06-25 16:29:33 +00:00
drh 4f07e5fbdf Remove terms with operator TK_AS from the expression tree. Ticket #2356. (CVS 3991)
FossilOrigin-Name: 5627ff74be9242418434a06fe5c104d1f9128cab
2007-05-14 11:34:46 +00:00
drh 32ffdb7393 Additional tests to give full coverage testing to ticket #2211. (CVS 3630)
FossilOrigin-Name: ecb1f2fd7b96797459287eaab95693ae17ec2079
2007-02-06 23:41:34 +00:00
drh 7b4fc6a8cb When optimizing out an ORDER BY clause due to uniqueness constraints, make
sure unused terms to the right in the ORDER BY clause to not reference other
tables in a join.  Ticket #2211.  Additional test cases needed before
closing this ticket. (CVS 3629)

FossilOrigin-Name: 912faf18d86416b1a36660851f8a4554e6746875
2007-02-06 13:26:32 +00:00
drh cc19254de9 The query optimizer does a better job of optimizing out ORDER BY clauses
that contain the rowid or which use indices that contain the rowid.
Ticket #2116. (CVS 3536)

FossilOrigin-Name: f245f5c2c2d337fe6458824beb7f9e721837765f
2006-12-20 03:24:19 +00:00
drh 8a51256c0c Create separate affinities for INTEGER and REAL. (CVS 2766)
FossilOrigin-Name: ce06c123d0c5663dbaf263c2e0aaf5d9cdeb2ccd
2005-11-14 22:29:05 +00:00
drh ec7429ae27 More efficient handling of the LIMIT clause. Scalar subqueries and EXISTS
on compound SELECT statements now working properly.  Ticket #1473. (CVS 2747)

FossilOrigin-Name: edca8913ca012fc0c17343a27f819de95147b1bd
2005-10-06 16:53:14 +00:00
drh 3d1d95e625 The SUM() aggregate function returns an integer result if all inputs are
integers.  Any single non-integer input causes the result to be a floating
point value. (CVS 2669)

FossilOrigin-Name: 21adf4bd99e732650a1e8e9a1cc954126983a654
2005-09-08 10:37:01 +00:00
drh a21c8495f9 Fix over-aggressive optimization of ORDER BY as reported on the mailing list. (CVS 2655)
FossilOrigin-Name: efbb4bc83cd86b6a26d58c5818c58c2e3edaab18
2005-09-01 17:47:51 +00:00
drh 4db38a7092 All regression tests now pass with the new bounded-memory sort code.
There is still lots of opportunity for optimization, however. (CVS 2654)

FossilOrigin-Name: 81259a01f1e85ba50a1d017b1282bf841b16f0a5
2005-09-01 12:16:28 +00:00
drh 9eb2028fbc After calling realloc() on an array to resize it, be sure not to use pointers
into the old array.  Ticket #1376. (CVS 2617)

FossilOrigin-Name: 9f9a257123274779150cbc290b9f86a09b3b2c03
2005-08-24 03:52:18 +00:00
drh 3adc9cedb0 The new optimizer now passes all regression tests. (CVS 2566)
FossilOrigin-Name: a21212843359fb9fdbd60799ae50ad3566f4399a
2005-07-28 16:51:51 +00:00
drh 7ec764a29e Add comments to test cases. Improvements to the query plan test variable. (CVS 2555)
FossilOrigin-Name: ef3a157f469d72cbd2f713f997598ddf47f340d2
2005-07-21 03:48:20 +00:00
drh 9042f395cc Fix bugs in the new query plan instrumention logic. (CVS 2549)
FossilOrigin-Name: 578490c91331a386f84652db0b3bfd74c82046e1
2005-07-15 23:24:23 +00:00
drh ba0232a0df Any non-zero value is considered TRUE in a WHERE clause. Ticket #1211. (CVS 2496)
FossilOrigin-Name: 0f7af623791d8d2ed35c3978ab12316912d9b6f8
2005-06-06 17:27:19 +00:00
danielk1977 3e8c37e7f8 Modify test scripts to work when SQLITE_OMIT_SUBQUERY (along with other OMIT macros) is defined. (CVS 2251)
FossilOrigin-Name: bb0254ab14417f0ab40f10f37cb63a60507f070a
2005-01-21 03:12:14 +00:00
drh ac931eb93b Fix for ticket #1062: Correctly handle redundant terms in a WHERE clause. (CVS 2198)
FossilOrigin-Name: 1bee1bb91d39ff8a33efe662b6cab6dbd2d50e3c
2005-01-11 18:13:56 +00:00
drh 9012bcbc0a The optimizer now uses only the index and ignores the table if it can get
away with doing so, thus saving a single BTree search per row of result.
This could potentially double the speed of certain queries.  The
code passes all regression tests but new tests to exercise the new
functionality are yet to be added. (CVS 2170)

FossilOrigin-Name: e5aa489453bf31126da6473ef93c89ec27935cde
2004-12-19 00:11:35 +00:00
drh 51669863a8 Improvements to the query optimizer. This is a work in progress. (CVS 2169)
FossilOrigin-Name: 9b86993ff721b577b920c7c67fb41d3d4355fe88
2004-12-18 18:40:26 +00:00
drh b6c29897eb Add initial infrastructure for cursors. In where.c, optimize out clauses
of the form "ORDER BY rowid" if a table scan is being performed.  Do a
reverse table scan if "ORDER BY rowid DESC" is present. (CVS 2141)

FossilOrigin-Name: fc8c1393c86017a816beb52725b68af3b973f979
2004-11-22 19:12:19 +00:00
drh 6bf895708c Update tests to work even if some features of the library are disabled. (CVS 2050)
FossilOrigin-Name: b11fc9b3f3a2711f98e7e45724aa1d30081197f3
2004-11-03 16:27:01 +00:00
drh 92febd92ad Tcl interface transfers values directly between SQLite and Tcl_Objs, without
at translation to strings. (CVS 1898)

FossilOrigin-Name: e97c331362545ce21117776c7b61d3488668f2bf
2004-08-20 18:34:20 +00:00
drh ce665cf60e Eliminate the OP_SortMakeRec and OP_SortCallback opcodes. Sort using the
standard record format. (CVS 1426)

FossilOrigin-Name: 25643a0137d395572f16cfec3ab3327d913138ba
2004-05-21 03:01:58 +00:00
drh 736c22b803 Most sorting problems are fixed. Dead code has been removed. 3 test failures
remain but will be fixed by the new function API once it gets implemented. (CVS 1425)

FossilOrigin-Name: 3b55095e036d68886d007239333bbf90acd15692
2004-05-21 02:14:24 +00:00