stephan
cac93a5be0
Add a call to Tcl_Init() in tclsqlite3's setup. This activates many of the otherwise-missing Tcl standard commands and is believed to be benign on systems where those cannot be loaded, but whether it truly is requires some experimentation on affected systems.
...
FossilOrigin-Name: 9eb5c91c897f8820affb30f8571eb927423c7831161f5df0043715e7f0a729d7
2025-07-22 20:17:06 +00:00
drh
5a6f651397
Fix a potentially uninitialized field in the WhereLoop object that is used
...
as part of the skip-ahead-distinct optimization. This fixes various
[forum:/timeline?ymd=20250722&u=yxchen&vfx|recent forum reports from yxchen].
FossilOrigin-Name: c10f9970c6a3ffacaef0f0728fc7ff11011686835dc78ca43035c0493e0af319
2025-07-22 15:51:41 +00:00
drh
2445ee0e37
Factor out the unusual encoding-change case from vdbeCompareMemString() for
...
a performance improvement in the common case, and a small size reduction.
FossilOrigin-Name: cbd46ab8a8b4622f42dd9f87f28b812c1d6fa5ea73a4e8f1253514455f397783
2025-07-19 20:10:07 +00:00
drh
ea8f9708c5
Small performance optimization in sqlite3VdbeRecordUnpack().
...
FossilOrigin-Name: eae168def2ff11f57f730f8a3bd86748b0943077e37b2709c10de0aecff664ec
2025-07-19 19:54:44 +00:00
drh
bcd14a0a3e
Split the (internal) sqlite3VdbeCheckFk() routine into two variants,
...
sqlite3VdbeCheckFkImmediate() and sqlite3VdbeCheckFkDeferred(), which
run faster than the combined general-purpose variant.
FossilOrigin-Name: 872b1b52ed93ef85911c2ef87b15673f9e102aef564f208e0a916af62671df93
2025-07-19 18:46:03 +00:00
drh
c585e03a4b
Use fewer CPU cycles to commit a read transaction.
...
FossilOrigin-Name: 861e55656abb208b4f1f2c8808c76c0454427af85a8930ab53f9c053605f39c7
2025-07-19 18:17:06 +00:00
drh
daa4cdf84a
Fix a minor comment inaccuracy.
...
FossilOrigin-Name: b66fcb61a1d044fa18419ab382a8b159e9b6bb52956917d8a9de4dccf8dc9a87
2025-07-18 19:17:32 +00:00
drh
bae748a76e
Increase the precision of the "real time" output from the ".timer" command
...
in the CLI from milliseconds to microseconds.
FossilOrigin-Name: c5dbe93114d318fea431859e388af74aeb4cb854c514c9910590441c990321f3
2025-07-18 17:40:34 +00:00
drh
74cc109780
Ensure that the accumulator for an aggregate always gets initialized,
...
even when the aggregate is on the right side of a LEFT JOIN and never
gets evaluated. This fixes a problem introduced by [663f5dd32d9db832]
and found by dbsqlfuzz. Test cases in TH3.
FossilOrigin-Name: 235cf6586b9ac914a32bd8adfd460daae998687f02f0998a7aa3c6bfc857d1c9
2025-07-18 12:10:15 +00:00
stephan
27e13f4f3a
Teach the sqlite3 CLI shell to look in XDG_STATE_HOME for the CLI history file before falling back to its historical location in the user's home directory.
...
FossilOrigin-Name: 1e663374c3fcc20ab0b3250aa1ff9d5e5ac391c89808ad589aa30c8882d4b61e
2025-07-16 09:27:55 +00:00
stephan
3a97a1ba8c
Squelch a legitimate but harmless 'discards const' warning.
...
FossilOrigin-Name: 73539fe0932494234b8f2293b0dbc1f0aac60a7d00fdaf4a59c2da654ce26f5b
2025-07-16 09:20:02 +00:00
dan
81e9bbf8da
Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].
...
FossilOrigin-Name: 9f184f8dfa5ef6d57e10376adc30e0060ceda07d283c23dfdfe3dbdd6608f839
2025-07-15 19:00:01 +00:00
drh
f8addcf937
Fix harmless compiler warnings in builds that use SQLITE_OMIT_DATETIME_FUNCS.
...
FossilOrigin-Name: e11fbf9fd630a7de2e0b0e4b67dded05b905b2a0ba04aa7e915ca9df2d9ebe21
2025-07-14 09:41:59 +00:00
dan
bcfe38b96a
Avoid evaluating special vtab operators (e.g. MATCH) that are part of ON clauses attached to left joins from being evaluated too early. Possible fix for [forum:/forumpost/428ef7c468 | forum post 428ef7c468].
...
FossilOrigin-Name: 18ba07c152294a96d510a7851a0860f982ff1e0725afeebed9a343f550f6925a
2025-07-12 18:14:41 +00:00
stephan
07b483c48e
Minor internal doc correction in vdbeInt.h.
...
FossilOrigin-Name: c3a2ef639c22255a298cbccb7fd871ec9b24929f82bf95d6982b12daf5c963d6
2025-07-10 09:27:57 +00:00
drh
33c2e37f98
Fix the empty-table optimization on INTERSECT so that it does not try to
...
use an uninitialized register for LIMIT processing.
FossilOrigin-Name: 6918ada008507b4564ca0dc5f4f6818c49a42eb14a16285b2074e21dcc8f2c3f
2025-07-09 20:11:49 +00:00
drh
8663a78ec9
Fix a possible user-after free following OOM in the EXISTS-to-JOIN
...
optimization.
FossilOrigin-Name: 498ee8d514e64cdc93a8d68e1971b6326c6132daf25067936bec921c42494caa
2025-07-08 22:11:39 +00:00
drh
aa12f0027b
Adjustments to test/incrblob4.test so that it works on both Linux and Mac
...
in spite of error message differences between those platforms. Minor change
to termIsEquivalent() to provide 100% MC/DC.
FossilOrigin-Name: 720387f8604f7cd997f1850ed62ce6ab32608155d7f02a89c695041caafc4067
2025-07-08 20:28:35 +00:00
drh
449b34571e
Enable the EXISTS-to-JOIN optimization if the outer query has no
...
FROM clause.
FossilOrigin-Name: 1b9b124f9a35ebd1ac4ea70ef1ee08a4c82c11da690d4164f6b785a6fd9730d9
2025-07-08 17:28:09 +00:00
drh
8c8443a38a
Small performance optimization in the resolver.
...
FossilOrigin-Name: 840646df0696706bd4dd7a04dfc8b16ad80c24cbcbc57a22c9e65a93cc17af2b
2025-07-07 19:03:50 +00:00
drh
44a03671c4
Merge the latest trunk enhancements and fixes into the empty-table-optimizations branch.
...
FossilOrigin-Name: f15cdf07573c05276a13885d74bae21a93544766344f19ef939b7a69edd1073b
2025-07-07 18:35:51 +00:00
drh
0a5508aeb4
Rework the fix to the problem described by
...
[forum:/forumpost/b9647a113b465950|forum post b9647a113b] so that it
provides a more complete fix that covers cases that were not resolved by
the original fix, and so that it does not cause performance regressions.
FossilOrigin-Name: 28db0d152d90fb5e62d03ea5caceabe8901be98522aef3dc2b54564fbc35355d
2025-07-07 16:19:44 +00:00
drh
4fe1ac8fe1
Simplifications to the row-value IN operator logic. Do not let the query
...
planner accept a WhereLoop for a row-value IN operator that uses the same
index column more than once.
FossilOrigin-Name: d2adf61f21a3ce901a2b08199ad0de191e88ef16e097c5f7a75c95ad958eff12
2025-07-07 15:40:53 +00:00
dan
8504d37b99
Avoid invoking the preupdate hook from within sqlite3_blob_write() if the cursor is already invalid.
...
FossilOrigin-Name: 9f335b9a4e9e761a0c6afd6dc69665a24506141bde88530bf59fcbdf957ae881
2025-07-07 11:37:55 +00:00
drh
4aacd1ef8e
Back out the fix at [ba7d5bad32ad6aac] because it does not always work and because
...
it causes a performance regression. Add new test cases for row-value lookups of
indexes that contain redundant columns, three of which are currently failing. This
branch is seeking an improved solution to the redundant index column problem for
row-value lookups.
FossilOrigin-Name: ad8ddcefab5cc526b1cd77731e00939c672e61ca83350d28961b67635d20da03
2025-07-07 10:54:00 +00:00
drh
0840460689
Fix parser error introduced by [325e547a2195571e]. See
...
[forum:/forumpost/095dbfc06e5b1f7e|forum post 095dbfc06e5].
FossilOrigin-Name: 4eefab44941fc6e17742fa49c8734e7f00a2177d82bc572e596228add53aad39
2025-07-07 02:18:27 +00:00
drh
c701d17366
Improvements to the EXPLAIN QUERY PLAN output for EXISTS-to-JOIN.
...
FossilOrigin-Name: 6b1ecbaa2ee405be040901dceac45d027d35c313622748ba4dbbd404e297a7fa
2025-07-06 01:19:09 +00:00
drh
8bc112e3e4
Enhance the EXISTS-to-JOIN optimization so that it works on EXISTS subqueries
...
that do not have a WHERE clause, and so that it works on nested EXISTS
subqueries.
FossilOrigin-Name: c1d5295724f9cf7f49e0786d28016eff2d268a2b670f934d24c76787626089db
2025-07-05 23:33:21 +00:00
drh
45bc9b9f97
Merge fixes from trunk into the empty-table-optimizations branch
...
FossilOrigin-Name: 6f98b16d210a9f5b6ca4b4599e3dab3263eddbae7c70ddbcabf988f4a1014e8b
2025-07-04 14:24:18 +00:00
drh
e33ea17d24
Fix harmless compiler warnings.
...
FossilOrigin-Name: 13af4acebe09b047756c22b800136cffaba532e7fcaa448a4edf4fedb94e9bbc
2025-07-04 12:25:24 +00:00
drh
a12e92d2f7
Remove an ALWAYS() added by [960a8e6fc91f4] that turns out to be false
...
in some cases of malformed SQL.
FossilOrigin-Name: cc8171461bf35f584888a24b844c8b79ad30155b19b61161e9f3abc276e8aae5
2025-07-04 11:48:11 +00:00
drh
478dfc7e74
Do not allow the EXISTS-to-JOIN optimization if the EXISTS clause is based
...
on a view, since that view might expand into a join.
FossilOrigin-Name: 872c41feddafcc21a02f1229ce017ceea9f8e309a4dd5b6e323477d67f975947
2025-07-04 11:06:34 +00:00
drh
1b62720fa8
Improve the early-termination optimization so that it works in queries
...
which use the LIKE optimization in the outer loop.
FossilOrigin-Name: b4e4d148243cfcb09aa0aaca30e83812b42e2780073e55c0e8c6e3da16243dfc
2025-07-04 10:26:55 +00:00
drh
1e3a862b79
Merge the latest trunk fixes and enhancements into the empty-table-optimizations branch
...
FossilOrigin-Name: d4f47e04f5880e99a53089e2dd5cde64a7ea44f059d9906b5d11324896546714
2025-07-03 20:51:08 +00:00
dan
0e6e05d4d5
Make the value of an explicit LIMIT clause on a scalar sub-query available to xBestIndex for simple "LIMIT 0" and "LIMIT 1" queries.
...
FossilOrigin-Name: 33b6a63caafccc61b3193714911cd8b5dd9b7f1798054b8c7845b23688d531f2
2025-07-03 15:32:27 +00:00
dan
c525e6e817
Make handling of LIMIT clauses in correlated sub-queries on virtual tables more efficient.
...
FossilOrigin-Name: 7214cb2a5b35190a06a1040cd4c54f325d347f8d8e36a07fd76c0a421e266522
2025-07-03 14:28:47 +00:00
drh
bfb4993364
Fix an uninitialized variable added yesterday by [d27d34fb746280e7].
...
This problem was discovered overnight by
[https://github.com/google/oss-fuzz |OSSFuzz].
FossilOrigin-Name: 6db4703f1178fc808f3a75c355fb6638fb12c88f6e1ce7f579e200ced8089114
2025-07-03 11:52:17 +00:00
drh
debc8f7bb7
Minor tweaks to the exists-to-join optimization.
...
FossilOrigin-Name: 9cb600ad576c68647ed943a0773019312c5f01c9c1ca9ff0bf1214b03a531b48
2025-07-03 00:17:27 +00:00
drh
aa54d7a0ca
Merge in the exists-to-join optimization that has been modified
...
to relax the requirement of having an indexed join constraint.
FossilOrigin-Name: 1c1aef2b7feae29066d0330699ab634ef41f5b60cdcd479a60cb1a5409553138
2025-07-02 20:46:02 +00:00
drh
eb27359e5e
Fix VDBE coverage
...
FossilOrigin-Name: ff593a16d61cc5c588d1737deb822abb90b1759475a4cabfcf608978b1191487
2025-07-02 17:43:59 +00:00
drh
33f3273705
Early exit if one of the inner loops of a 3-way or larger join is an
...
empty table.
FossilOrigin-Name: eaad6ac707a5960d9518d4049b7b1759e7512727ce87be3c402408144bda0a97
2025-07-02 14:53:48 +00:00
drh
216676664d
If the LHS for an EXCEPT or INTERSECT operator is empty, skip over the
...
computation of the RHS.
FossilOrigin-Name: 13f096ae8a850a05d4a8684561066f11693ee66289e6568c44ef32822cca06f6
2025-07-02 13:19:24 +00:00
drh
6245e5a46b
Improve the bytecode for joins such that it exits earlier if it determines
...
that no output is possible.
FossilOrigin-Name: 2d2b61cba44a756a3a41ef5c95bbb0c0b7111f4b679c578fec9bd0b214cca367
2025-07-02 11:47:54 +00:00
drh
caf0473652
Ensure that Expr.op2 values for TK_AGG_FUNCTION nodes are adjusted when
...
query flattening.
FossilOrigin-Name: d27d34fb746280e7e81335db4e195914b15403ef0da7b2955550553dd78fbe9a
2025-07-02 02:03:43 +00:00
drh
2427ce16d9
Improved comments on bytecode used to implement aggregate queries, to aid
...
in debugging.
FossilOrigin-Name: a1a8b85cdba64a17dcdcd4e6b42b872957cec2dc05b0ac34dfcd82f59344034b
2025-07-01 23:17:36 +00:00
drh
46bfcc1a21
Improved byte-code comments for the short-circuit optimization of
...
[0083d5169a46104a], to aid in debugging.
FossilOrigin-Name: 113f9d10e347eeaa893ff8b47a461009e0b12589374b93cf3e0bddd19c702dea
2025-07-01 20:32:45 +00:00
drh
5e71497404
Cache and reuse virtual table cursors in the bytecode engine.
...
FossilOrigin-Name: 2d187d4232d750cb1840f1d89c8aed65962cb0883c1d7f91c554b451e475c514
2025-07-01 17:36:55 +00:00
drh
e1910ed1d2
Merge trunk fixes into the empty-table-optimizations branch.
...
FossilOrigin-Name: 63306e447efb3ac17e789a331ed3bb65459eb8b79d66e9c185ba3bd852f34ce3
2025-07-01 15:13:37 +00:00
drh
d82c6a2cf7
When attempting to optimize "expr AND false" to "false" and
...
"expr IN ()" to "false", take care not to delete aggregate functions
in the "expr" as doing so can change the meaning of the query.
See [forum:/forumpost/f4878de3e7dd4764|forum thread f4878de3e7].
FossilOrigin-Name: 77397bd67d918db57d5ac545d6d963194806fdabcdaa8f822b6b09e4cfe8b715
2025-07-01 12:43:13 +00:00
drh
3d21dcc924
More aggressive optimization of addrHalt for RIGHT JOIN.
...
FossilOrigin-Name: 5e51d1c0dfcafef9e71c99de3f626dee157c935724b84c6e0c630299a880446f
2025-06-30 21:07:08 +00:00