summaryrefslogtreecommitdiff
path: root/src/wherecode.c
AgeCommit message (Collapse)AuthorLines
2 daysAvoid optimizations that persist (such as Bloom filters) on correlateddrh-0/+1
subqueries which are part of write operations and hence might have their content changed, making the Bloom filters obsolete. [bugs:/info/2026-11-20T23:56:37Z|Bug 2026-11-20T23:56:37Z] FossilOrigin-Name: af26d82bcc9ff12a297c78cfdbe052381d5096a4894ab9578666acfe6a5944cc
10 daysFix the IN-early-out optimization for row-value cases when the NULL bypass ↵dan-1/+3
skips a required affinity on the LHS. This extends the fix in [eb40248ce6]. Report [bugs:/info/2026-11-04T00:58:35Z | 2026-11-04T00:58:35Z]. FossilOrigin-Name: b3cf602a90682e1d01080ec7f8f9ecb6eb0bb63a86bb3e5db7054458ec82cccf
12 daysEnsure a statement is marked as may-abort if it uses an aggregate or window ↵dan-0/+1
function, or if it reads from a virtual table. Reports [bugs:/info/2026-11-04T20:27:20Z | 2026-11-04T20:27:20Z] and [bugs:/info/2026-11-04T20:31:13Z | 2026-11-04T20:31:13Z]. FossilOrigin-Name: c9c3554918eea74702b8fb8fb6d9faddd2363651eef59b4ca83b559af695aa24
2026-11-05Do not run the WHERE_IN_SEEKSCAN optimization and thedrh-0/+1
WHERE_BIGNULL_SORT optimization at the same time. We don't know that this causes problems, but neither do we know for certain that it is safe, and the need for both is exceedingly rare, so why risk it. [bugs:/info/2026-11-04T20:28:07Z|Report 2026-11-04T20:28:07Z]. FossilOrigin-Name: 56a5b1b9ae0e14b8d23cec79e4710550323133314658d53080e9de1275d1f072
2026-10-23Fix query planner error in the case of a multi-index OR on a WITHOUT ROWIDdrh-1/+3
table where the OR-term uses the seek-scan optimization. [bugs:/info/2026-10-23T03:09:01Z|Bug 2026-10-23T03:09:01Z]. FossilOrigin-Name: b33ff35e6246a9dc62205db244511eead28fae90cea686e205effae5e6cc5b49
2026-10-18If terms on the SELECT on the RHS of a vector IN are removed, then thedrh-0/+3
subquery cannot be reused for other things, since it is now different. [bugs:/info/2026-10-16T22:07:15Z|Bug 2026-10-16T22:07:15Z] FossilOrigin-Name: 080338a91b447c12186bbb4e23da1927ca448fee9a11cd6507f5f2041ee2dcba
2026-10-15When a single loop uses an IN(...) expression and a LIKE/GLOB expression ↵dan-3/+14
with an index, nest the 2-iteration loop that scans ranges of text and blob values using the LIKE/GLOB pattern inside the IN(...) loop in order to ensure that results are scanned in index order. Report [bugs:/info/2026-10-13T18:54:28Z | 2026-10-13T18:54:28Z]. FossilOrigin-Name: 08e979525ff1eef80c8e824c80cca7b6a3dfb320122258803673ace43c806c9a
2026-10-13Fix the implementation of Tree-Tracker.drh-3/+9
[bugs:/info/2026-10-13T02:17:32Z|Bug 2026-10-13T02:17:32Z]. FossilOrigin-Name: bfe473ab60f666449b819f0a55e936cef5359e32fd61683437d2ee3e0f3ff6c6
2026-10-10Minor refinements to the TreeTracker (aka "JoinMiss") optimization.drh-8/+11
FossilOrigin-Name: c1ad888eec410613fd5d8ce7e9192bafe4073ad56e87d0232b320b53d5e07120
2026-09-30Incremental improvements.drh-13/+9
FossilOrigin-Name: aae085c5ac6869988e97f0d7ed2f208a900adb8b76c6f940a7a33c10a60b1085
2026-09-29An early attempt to implement the tree-tracker optimization.drh-10/+130
FossilOrigin-Name: ead82958b3edd02e3da8fc3dbec880215d2539d4e0e7b97d3a689793d4938d22
2026-09-29Reset the nullRow flag on the pseudo-cursor on each iteration of the loopdrh-0/+3
when the RHS of a LEFT JOIN is a multi-row VALUES clause. Fix for [bugs:/info/2026-09-29T00:41:09Z|Bug 2026-09-29T00:41:09Z]. Problem introduced by check-in [a120c9235f125e05] with a missed opportunity to fix the problem at check-in [8c0f69e0e4ae0a44]. FossilOrigin-Name: 8e59d3c0a428ff12ea852c7a9f15b6b7b4ca0da55708f3d303b2e88818a17476
2026-09-03Omit a minro optimization that fails in two ways: (1) it does not actuallydrh-11/+1
make the code run any faster, and (2) it allows an incorrect type coercion on a GROUP BY query where there is a subquery as one of the result set columns. [bugs:/info/2026-09-03T02:29:56Z|Bug 2026-09-03T02:29:56Z]. FossilOrigin-Name: 5d9e5cddec144492df866bf0ea1808b1c099be92551cbb2433a0f3a0ff119023
2026-08-25Avoid coding WHERE constraints too early when using the OR-optimization with ↵dan-16/+45
OUTER join queries. Report [bugs:/info/2026-08-25T02:08:22Z | 2026-08-25T02:08:22Z]. FossilOrigin-Name: a3d15e4937c8f767db046615994f53618be0a407dee09a1989a6382e9b945574
2026-08-24Fix harmless compiler warning.drh-3/+5
FossilOrigin-Name: 0c5f5b37cec32c270c2b956e7627bf2eec38baa1b4625a7dbed8a49564ec8d37
2026-08-24When generating code to evaluate a vector IN constraint where the RHSdrh-1/+7
of the IN operator is a subquery, if the removeUnindexableInClauseTerms() subroutine changes the order of terms in the IN operator, then do not allow the modified IN operator to reuse a previously generated evaluation of the subquery. [bugs:/info/2026-08-23T06:58:36Z|Bug 2026-08-23T06:58:36Z]. FossilOrigin-Name: 8ee92456eb21878c44732e9adaac64009133eb03c36a7390b42427d63ff4a340
2026-08-18Limit the number of nested RIGHT JOINs (or FULL JOINs) that can occurdrh-1/+9
in a single query. Report [bugs:/info/2026-08-18T07:03:05Z|2026-08-18T07:03:05Z]. FossilOrigin-Name: 003ed951d85416da97f5cabf96d89b974279bd8ef2433ae1987bdedad38a4b90
2026-08-14Adjust the bytecode so that in a RIGHT OUTER JOIN, whenever a row from thedrh-7/+25
RHS table is added to the output set, the "match" index is updated to avoid duplicate rows. FossilOrigin-Name: 9d39b0973bff5af1787fafdd49e455c6c27d493c3bce997ae0fdf88eb9adb1d2
2026-08-13Disable the seekscan optimization for IN(...) expressions when the RHS is a ↵dan-3/+12
SELECT that returns more than one column. This was previously only possible if the sqlite_stat1 table was populated with inconsistent information, and was malfunctioning in some circumstances. Report [bugs:/info/2026-08-13T08:45:47 | 2026-08-13T08:45:47Z]. FossilOrigin-Name: 9544d46a6d51dbc12057e33ec1a635cd2cd48101c46d4b92171b56b70ea23f53
2026-08-13Ensure that if a seek-scan is used for an expression like (x, y) IN (SELECT ↵dan-1/+3
a, b FROM ...) then the SELECT delivers rows in order of (a, b). FossilOrigin-Name: c9661d928e9002771b586f09e7b6bad15ffba4466a52a7ca441a661ea2ffdbec
2026-07-29Always take a copy of a value used to drive an index as part of a RIGHT JOIN ↵dan-1/+6
loop. Otherwise, the RIGHT JOIN loop and the body of the loop it jumps back into may interfere with each other. Possible fix for [bugs:/info/2026-07-29T05:33:50Z | 2026-07-29T05:33:50Z]. FossilOrigin-Name: d7ad2d0a91b7b837b09b04f78e617fe80eb5ae48f178446c942c2a84e0e0201a
2026-07-23Add the ability for Bloom filters to work on text values, as long asdrh-6/+13
the collating sequence is BINARY. FossilOrigin-Name: 2577edc796505a0a6dabccbcc1bb6a828457092caa4d074561da5e58a6f065a2
2026-06-01Fix minor problems surrounding transitive WHERE constraints and explicit ↵dan-0/+1
COLLATE terms. FossilOrigin-Name: 9500238a1d603a3f08a8fc0954725d5d217aab339720146ea0bc700e47b81c3c
2026-05-04When using the OR-optimization on a loop created by exists-to-join, do the ↵dan-2/+9
early-exit logic for the whole loop, not for each individual OR branch. Possible fix for forum post [forum:c8b205720c | c8b205720c]. FossilOrigin-Name: 3d197dd03c47a0fb687064131dbf519b8c587a47f9c2bccfdb83d7eae8418336
2026-03-09Fix a problem with RIGHT JOIN and expressions on indexes. [forum:e3dba5426a ↵dan-0/+9
| Forum post e3dba5426a]. FossilOrigin-Name: f27d578edac06eb28739f23351ab1cf07531bc7b32f4077e4dc9c8166f551d95
2026-02-05Do a better job of not generating unnecessary Bloom filters associateddrh-1/+1
with IN operators. FossilOrigin-Name: 3861df5c127f82becea80c48c547de8ed0d01eebcf6a6a9d7f234dde31f50394
2025-07-30Move the flexarray union members from [527bbc1676a85a9] to the end of their ↵stephan-1/+1
respective objects. FossilOrigin-Name: 3082e07926695863bd5ef51c3c4803fbe267dc0d9b6ac9a717c225459f8988ba
2025-07-30Apply alignment-related patches suggested in [forum:41cd226375cd49c6 | forum ↵stephan-2/+5
post 41cd226375]. FossilOrigin-Name: 527bbc1676a85a927352cd10a292afe041a72692ec0b1360e5a1ccaa19a32fcb
2025-07-07Merge the latest trunk enhancements and fixes into the ↵drh-18/+11
empty-table-optimizations branch. FossilOrigin-Name: f15cdf07573c05276a13885d74bae21a93544766344f19ef939b7a69edd1073b
2025-07-07Rework the fix to the problem described bydrh-18/+11
[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-07Simplifications to the row-value IN operator logic. Do not let the querydrh-17/+8
planner accept a WhereLoop for a row-value IN operator that uses the same index column more than once. FossilOrigin-Name: d2adf61f21a3ce901a2b08199ad0de191e88ef16e097c5f7a75c95ad958eff12
2025-07-06Improvements to the EXPLAIN QUERY PLAN output for EXISTS-to-JOIN.drh-10/+4
FossilOrigin-Name: 6b1ecbaa2ee405be040901dceac45d027d35c313622748ba4dbbd404e297a7fa
2025-07-02Merge in the exists-to-join optimization that has been modifieddrh-1/+9
to relax the requirement of having an indexed join constraint. FossilOrigin-Name: 1c1aef2b7feae29066d0330699ab634ef41f5b60cdcd479a60cb1a5409553138
2025-06-30More aggressive optimization of addrHalt for RIGHT JOIN.drh-11/+0
FossilOrigin-Name: 5e51d1c0dfcafef9e71c99de3f626dee157c935724b84c6e0c630299a880446f
2025-06-30Compute WhereLevel.addrBrk and .addrHalt early so that those labels can bedrh-9/+12
used to abort loops early. Use this to improve performance on two more of the cases described by [forum:/forumpost/52651713ac|forum post 52651713ac]. FossilOrigin-Name: 6fc0b9ac23be6840542982de4bb282ebca1db8b5ab3baefdde95a997c1506e81
2025-06-06Remove unnecessary whitespace and otherwise improve comments in thedrh-37/+37
wherecode.c module. No coding changes. FossilOrigin-Name: 2eb4e9bf0f2df50324a62fb272a92bbd931b8b4e4b35bac0c05b676c97b61339
2025-05-29Extend the fix for ticket [623eff57e76d45f6] so that it covers RIGHT JOINdrh-4/+5
in addition to LEFT JOIN. Problem reported by [forum:/forumpost/7dee41d32506c4ae|forum post 2025-05-29T15:10:14Z]. FossilOrigin-Name: 29b1e1b97619d03a97ef562a5707929e241d019179b4ff1d0bc2a8c008441431
2025-05-19Remove stray tab characters from source files.drh-1/+1
FossilOrigin-Name: 298ff5a1dc5dbccaf6acd91731044f478a5ce522745332801708ceee996b01e6
2025-04-15Fix a minor typo in a code comment.drh-1/+1
FossilOrigin-Name: 158e8c4fd7bdfc1cd4c0135abecd0d00994cd4027cf74ce6e5cf73d76475ae95
2025-04-10Remove unnecessary "www." prefixes on domain names in URLs.drh-1/+1
FossilOrigin-Name: 20acd630b91609725794ce84f9eda01d5f3c898407f0948264830851d25ccaa6
2025-03-14Make use of the flexible-array feature of C99, when available, to try todrh-8/+9
pacify -fsanitize=strict-bounds. This check-in fixes the core. There is more yet to do in FTS3, RTREE, and in FTS5. FossilOrigin-Name: 6fd6b32d06bd6a705e5140cd613af823b8183a6f6a9ceeeedfcf5e8b50821d68
2025-02-07Fix comments on the Parse.nMaxArgs field so that they are correct. Adddrh-0/+3
assert()s to ensure they are correct. Other Parse changes to reduce the amount of memset() needed to initialize it. FossilOrigin-Name: c56092507c96723030589ddd9121bc993d615a7acd453305fc3b1dbb9e30554c
2024-11-20Bug fix in the SubrtnSig logic from [c9a3498113074bbc], if a subquery isdrh-0/+1
copied and then changes are made to the copy, be sure to give the copy a unique Select.selId value so that the original will not be substituted in place of the modified copy. [forum:/forumpost/0b9ded2f8428ac00|Forum post 0b9ded2f8428ac00]. FossilOrigin-Name: 19d1bede5654bcfa9f7a151b9b2616a3d10873b8e3f8cf54a3a7e810da08f844
2024-10-23Fix harmless compiler warnings in wherecode.c. One such warning wasdrh-1/+6
identified by [forum:/forumpost/721675f007|forum post 721675f007] and the other was found by tool/warnings.sh. FossilOrigin-Name: 987b96aa636c1801f87d3e1c75d34d45c5b6f437bcc6d150298675447ed16b5d
2024-10-11Experimental change to explain query plan to identify covering indexes on ↵dan-15/+50
expressions. FossilOrigin-Name: 3bb03a2891e30c58b66e3665a8877a8eab4a8bac57ee153d8d31358caeaf4b7c
2024-08-22Add the SQLITE_INDEX_SCAN_HEX bit to the sqlite3_index_info.idxFlags bitmask.drh-1/+3
When set, this bit causes the EXPLAIN QUERY PLAN output to show the idxNum value in hex rather than in decimal. This is purely a debugging aid. FossilOrigin-Name: 6c00e88ebdb41d6317bb8758825521614dedc2e6e6289ff415c5f0406eed815b
2024-08-19Refactor the SrcItem object so that information about subqueries is storeddrh-5/+15
in a separately allocated Subquery object. This reduces the memory requirements for SrcItem and makes the code run faster. It also provides an expansion path for subquery processing that does not burden simple queries. The current checking mostly works, but there are still issues that need to be tracked down and fixed. FossilOrigin-Name: 8ff5dda8448d7e1a533d7f27db2573ce68fa9956b9d9847ced45e83c1f06bab0
2024-08-17Give unique names to fields in the SrcItem object, to facilitate analysis ofdrh-13/+14
how those fields are used using "grep". FossilOrigin-Name: 9f5aeef3cbc2c95267c8f7bf60d5c66971a76789669fb0e8f853273ff6f616f2
2024-06-05Small performance optimization in the codeEqualityTerm() routine of thedrh-116/+143
code generator. FossilOrigin-Name: 8080c6eafd1280ea870a6ab1ba715ac5af67387e69771be6cbd46dda77c3eaa8
2024-05-31Document the OP_Explain opcode. Add the WhereLoop.rRun value as P3 indrh-1/+2
OP_Explain opcodes associated with WhereLoops, for testing purposes. FossilOrigin-Name: 996c46e61d9a53a54018672dd407b8ba8c480dd6795393428f9d5fcb81b47ab5