aboutsummaryrefslogtreecommitdiff
path: root/src/whereInt.h
AgeCommit message (Collapse)AuthorLines
3 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
12 daysFix the IN-early-out optimization for row-value cases when the NULL bypass ↵dan-0/+1
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
2026-09-29An early attempt to implement the tree-tracker optimization.drh-0/+1
FossilOrigin-Name: ead82958b3edd02e3da8fc3dbec880215d2539d4e0e7b97d3a689793d4938d22
2026-07-23Add the ability for Bloom filters to work on text values, as long asdrh-4/+1
the collating sequence is BINARY. FossilOrigin-Name: 2577edc796505a0a6dabccbcc1bb6a828457092caa4d074561da5e58a6f065a2
2025-06-30Compute WhereLevel.addrBrk and .addrHalt early so that those labels can bedrh-0/+1
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-16Improved debugging output for the transitive constraint optimization.drh-0/+3
FossilOrigin-Name: 94b53c20e9bc8687c44272419aa7a93076eebdeae9a4f50b95b96a49993f9c0d
2025-03-15Fix alignment problems on Linux with -m32 and on Mac PPC.drh-1/+1
FossilOrigin-Name: 8a91aeca60548d5cd19add128cf65b9c3815c9103b1ef8ff6bc02711b6d709de
2025-03-14Make use of the flexible-array feature of C99, when available, to try todrh-1/+6
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-01-26Small size and complexity reduction on the star-query heuristic. Improveddrh-2/+4
comments for the star-query heuristic. FossilOrigin-Name: a7ecb2f4b7eee78b88f1b2e026dffed2007ca4ffeb152632624ab2582839b250
2025-01-25Revise the strategy used by the star-query heuristic: Instead of decreasingdrh-2/+2
the cost of all fact-table WhereLoops, increase the run-cost of WhereLoops that are SCANs of dimension tables. FossilOrigin-Name: 1bc09c9e8bd77ac41ecbe510c7e003757fc11d0f586da6cdf3584315aa9d6407
2025-01-24Minor tweaks to the star-query detection and processing.drh-0/+4
FossilOrigin-Name: 61f76a45ac7aa454419fd7539a3d8e60f0733fb5a2abd034d795328f3c1b6e9b
2025-01-15Variable names and conditional logic simplified in where.c. Thesedrh-1/+1
changes are cosmetic only and do not affect the resuling machine code. FossilOrigin-Name: dbc2d6a244fdafd208239894dbdd8f139db6ca20dd8f1ed00d87028e0cb60570
2024-10-11Experimental change to explain query plan to identify covering indexes on ↵dan-0/+8
expressions. FossilOrigin-Name: 3bb03a2891e30c58b66e3665a8877a8eab4a8bac57ee153d8d31358caeaf4b7c
2024-08-22Add the SQLITE_INDEX_SCAN_HEX bit to the sqlite3_index_info.idxFlags bitmask.drh-0/+1
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-15If a subquery is materialized due to an ORDER BY and that ordering is usefuldrh-1/+3
in helping to satisfy the ORDER BY or GROUP BY in the order query without doing an extra sort, then omit the extra sort. FossilOrigin-Name: 2fbb4dc2327ee435cb2b7a4adcddf5a9cee6dff7de96e2ecb761166427b5ddea
2024-05-29Remember the amount of the heuristic cost adjustment associated withdrh-0/+2
star schemas and compensate when computing whether or not to use Bloom filters. FossilOrigin-Name: 21daf2463ef70e6b5dc73ba5bf62b3d2fb504e9189f645ac74b513d3d8b979c2
2024-05-29Use a heuristic in the query planner to help it better cope with largedrh-0/+1
star schema queries. FossilOrigin-Name: a98be0f548f277fab8f38a2dec6ddcbe7a7fff27856ba19e76ad8c5641894b7b
2023-12-22Change parameters on a debugging function to include "const".drh-1/+1
FossilOrigin-Name: 94c3e1110c6590261bd30ba317fba4dd94023d69b81a94f4b216cce748fe7489
2023-09-15The view-scan optimization was added to enhance the performance of one specificdrh-1/+1
query, but it causes performance regressions on a host of others. Disable it (at least temporarily) in order to try to find an alternative way of fixing the one specific query that it was created to fix - an alternative way that does not cause performance problems for other unrelated queries. FossilOrigin-Name: d9625a9eafe88859c3255849ee750cc6322d5a13ddad45107f9b2085c20eff50
2023-06-07Add a C-source spell-checking facility. make misspell (on Nix)larrybr-7/+7
FossilOrigin-Name: 26c1bb4bd9e9f56613c3aa87407a7f562fd4ebde5bfd6dece02078001d9a45f8
2022-11-28Rework the covering index checking routine, whereIsCoveringIndex(), so thatdrh-0/+1
it can return a "maybe" result for aggregate queries where we are not exactly sure. The index is scored as if it is covering, but the main table is still opened. FossilOrigin-Name: b8eec4214363192e6f3e12b3faa5810d8269a5fdaecab3ec09b02e5002cf798a
2022-10-22This branch attempts to improve the detection of covering indexes. Thisdrh-3/+1
first check-in merely improves a parameter name to sqlite3WhereBegin() to be more descriptive of what it contains, and ensures that a subroutine is not inlines so that sqlite3WhereBegin() runs slightly faster. FossilOrigin-Name: cadf5f6bb1ce0492ef858ada476288e8057afd3609caa18b09c818d3845d7244
2022-10-20The generalized indexed expression optimization of [2435112867fbd7b6] makesdrh-15/+2
the prior [a47efb7c8520a011] enhancement from 2017 obsolete. This check-in removes the older optimization. FossilOrigin-Name: 56442c9bdd7844454c79acf83323380ea3509cb2e0b9a3d538a6b51726ae6d07
2022-10-19Fix references to "SrcList_item" in comments as that object has sincedrh-1/+1
[bfd5bf2c73110fcb] (2021-02-21) been called "SrcItem". Comment changes only. No changes to code. FossilOrigin-Name: e3648a07f5607dbd4d6ad5b6e5a62a4a1d0b173d3f22aa36c74b768281fc86d8
2022-09-01In the query planner, add a heuristic that will reduce the cost of a fulldrh-0/+1
table scan for a materialized view or subquery if the full scan is the outer-most loop. This is shown to speed up some queries. FossilOrigin-Name: 609fbb94b8f01d6792e5941ab23ce041313d359f6788c4dde6b1ca749ab49137
2022-06-01Candidate fix for the problem with row-value WHERE clause constraints ondrh-1/+2
a RIGHT JOIN. FossilOrigin-Name: fdd782a7bb217e2aceda97a588c0d7874ee19885abfcf0658472d6c3387da6ee
2022-05-10Fix a bug in the sqlite3WhereMalloc() routines that were added bydrh-1/+1
chekc-in [f237e1d8cc41b937]. The bug was detected by dbsqlfuzz test case 4c5e3e89bc251d28378be88233f531b84ec66901. FossilOrigin-Name: 764b71267e0b31ff7eaf2a0def7526a1a02dce4d5b456dea060d97ed342efdd1
2022-04-23For debug builds, if the RIGHT JOIN body subroutine contains a jump thatdrh-0/+1
escapes the subroutine, then abort the prepared statement with a descriptive error and SQLITE_INTERNAL. This extra sanity check causes many tests to fail. FossilOrigin-Name: 2c5bb2bff26cc70d8cac78ddd12d5ac37ab1472f5f88afbd975950a18ac2804d
2022-04-17Change OP_Return such that if P3 is 1, the Return is a no-op when thedrh-1/+0
P1 register contains a NULL. FossilOrigin-Name: c90602328a4b26f06d76c5343d29ebb7a782186c86ea88f5965a41040cff5346
2022-04-12Factor out the RIGHT JOIN non-matched row loop from sqlite3WhereEnd(). Thisdrh-0/+5
reduces the register pressure on that routine and helps it to run faster in the common case where there is no RIGHT JOIN. FossilOrigin-Name: beeecf1604d4fb11e45058f48cb2289c6542e0bc218d63a245198113d8d5476b
2022-04-11Fix handling of "continue" and "break" from inside the loop for the rightdrh-0/+1
operand of a RIGHT JOIN. FossilOrigin-Name: b6e773a26c2c6ee76ea61acb059b4e676d07ea62f6db9c513638f8986557cf04
2022-04-09The interior of the RIGHT JOIN loop is now a subroutine.drh-1/+12
FossilOrigin-Name: 549f5a7ee639de80f049445002f58e93c805f9a3d3db1987ec9d139ccef4805e
2022-04-09A few bits and bobs of code generation toward getting RIGHT JOIN to work.drh-0/+1
Much more remains to do. FossilOrigin-Name: 55b4543122646997d928598343bc467c993f971e86e9037c85430cc948750576
2022-04-09The sqlite3WhereMalloc() routine allocates memory that is automaticallydrh-0/+13
deleted when the corresponding WhereInfo object is destroyed. FossilOrigin-Name: f237e1d8cc41b937f34288daebfacf5f7b0990a807a805e0cb6b45bc730192d6
2022-02-04Fix various harmless compiler warnings.drh-2/+2
FossilOrigin-Name: 70049342d5ad57ea3e863bba19253934b868bacdd1c26c9371bac024a829badf
2022-02-04For the MULTI-INDEX-OR optimization, when pushing down WHERE clause terms fromdrh-0/+1
the main query into the various OR-term subqueries, do not push down slices of a vector comparison, since the right-hand operand of the comparison might have only been initialized in a different OR branch that was not taken. dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1. FossilOrigin-Name: 9f67ad00cd38b7c5ec6d14b379e1a611777bbdf6901d843a80712ba7d94d6d33
2022-02-01Add new interfaces to enable virtual table to process IN operator constraintsdrh-0/+1
all at once, rather than one element at a time. FossilOrigin-Name: eb84b80e1f6d8c32bf0c9e1731f0233de0160a13f714f766779ae01fdf504e7b
2022-01-27Query planner always honors the aConstraintUsage[].omit flag for thedrh-1/+3
SQLITE_INDEX_CONSTRAINT_OFFSET constraint. FossilOrigin-Name: 38c5151eb8cc789ad082a1b40d16b2ddb55454219bd685b6e420995af6a15f55
2022-01-27Give the virtual table xBestIndex method access to (some) OFFSET and LIMITdrh-0/+4
clauses. FossilOrigin-Name: 74fa5757ee0a8499bcd6546dac1a3ecc6048ba9cff9e3e574e28e6e82e894a3d
2022-01-22Omit the WhereLoopBuilder.pOrderBy field, which is no longer needed.drh-1/+0
FossilOrigin-Name: a13afc909c8bb643aa154b39ba8c023bae7352d3cd7cfb96be3891fa0e4bc045
2021-12-15Simplify the generation of the sqlite3_index_info object during query planningdrh-1/+1
for virtual tables. FossilOrigin-Name: 241dc0428a6e0238c57e2449e98ea60047e777e29c83a4ebe6da16f7cba40e19
2021-12-09Add SQLITE_TESTCTRL_LOGEST and enhance the LogEst utility program.drh-1/+1
Improvements to testability of bloom filters. FossilOrigin-Name: 88b43d798cc5aa59855e92d3e658aee9f0a5def6ffbc5db77af048d75ecdf8cc
2021-12-08Improvements on the decision of whether or not to use a Bloom filter.drh-0/+1
FossilOrigin-Name: 0fb2a4e08f518cb38ea3edc6a084d1e4874fd622ba3cf9101b49b3e7dc1a3f2b
2021-12-08Merge the WhereClause fix from trunkdrh-0/+1
FossilOrigin-Name: d3250256772e3348abe887c0ca3550a6647cce3804c9456a9d0112aea7ee1c46
2021-12-08In the WhereClause object, do not assume that all TERM_VIRTUAL terms appeardrh-0/+1
at the end of the list, because that is no longer true. Instead, keep a separate nBase count that is the size of the list excluding the tail of virtual terms. Use nBase instead of nTerm when scanning terms that are not virtual. Add assert()s to validate correctness of WhereClause. FossilOrigin-Name: 6024682ca467fa4fe49608772b0bbfa2f8a419b32cebfa715941073c8b29da49
2021-12-05Run as many Bloom filters as possible before index lookups.drh-1/+6
FossilOrigin-Name: 06f6fefd67086896bc49272c6319545ff6c6792f18babe23aced27b60b032119
2021-12-05Try to run all Bloom filters before any Seeks. This gives a small performancedrh-0/+1
gain on the Star-Schema Benchmark. FossilOrigin-Name: 5be2470f8755ef454f813c880e659bdbf82f2396be9320cf3079cd4ca8e81a19
2021-12-04First attempt to use Bloom filters to optimize star-schema queries.drh-0/+1
FossilOrigin-Name: 28161fba9bcde5ae4b36b22d766c881b795af111a3a323c90f6149d0fea9297d
2021-12-03Merge recent trunk enhancements into the bloom-filter branch.drh-8/+3
FossilOrigin-Name: 11d97fb8be6b5155f38df130d7e828edd0f381e32f651458939b1cb9cb973fff
2021-12-02Small performance optimization in sqlite3WhereGetMask().drh-8/+3
FossilOrigin-Name: 7edec54ab045c0493fc5d27d47d7bf0e08d3b0b298f428646fd3f0ee24dfcade