1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00
Commit Graph

25663 Commits

Author SHA1 Message Date
drh
e9689e7dae Do not use any index field with a collating sequence of DATACOPY to speed
a look-up.  Use such fields only for covering queries.
*This is an experimental branch*.

FossilOrigin-Name: aef529e6fcb682aa684c803d2e9eca5f40f1d83fdab8098183641e0da49d03b9
2025-07-25 21:45:58 +00:00
drh
9c620c0e4e Add the datacopy extension, used for testing only.
FossilOrigin-Name: 06735507ae28fbcd0d43715434ddd74c5dfa4609cd9cb4d1994ca125b9d8dd68
2025-07-25 20:37:56 +00:00
drh
fec09c815d Improvements to the scope of valueFromFunction().
FossilOrigin-Name: b021399a6e93afbb3368a5ae94c0f29c97ec6603bf9a5b7f86ca63c94590c2c3
2024-09-18 18:04:30 +00:00
drh
0553bcf0a3 Allow the query planner access to the argument of LIMIT even if that
argument is a bound parameter.

FossilOrigin-Name: 148d505ca08adcc776748d4d01fde022ab5add745d6b2573922a66e516b51681
2024-06-07 00:20:53 +00:00
drh
877051b246 Better optimize queries that use parameters in the LIMIT clause.
FossilOrigin-Name: b44f2676716be37d85eb6f207e187d997fc9d7493883bd7f1541cc7ae52475be
2024-06-06 16:06:21 +00:00
drh
80fe886efc Fix typos in comments. Provided ".wheretrace" debugging output for the
interstage heuristic module.  Do omit automatic index loops in the
interstage heuristic.

FossilOrigin-Name: 357d9513d2bd13c4e9f227300d43a04d13ae1d34b0b5ec55e8b94eb3204d1921
2024-04-02 18:48:25 +00:00
drh
efb848d53b Fix table-valued functions so that they will work as the right table
in a LEFT JOIN.  Ticket [2ae0c599b735d59e]

FossilOrigin-Name: 1f97086d628b6f52e6f9a87cd9d2c365f3c51f5b33c5c36a3f83889ec08765be
2024-04-02 18:31:48 +00:00
drh
8aabb0a2e8 Add a heuristic in between the two solver() passes of the query planner that
tries to prevent a very slow query plan in cases where the output row count
estimate is imprecise.

FossilOrigin-Name: 74b247d958d74782302546dcce8c8d8fba021b7f3d801ef6823225fb3213065f
2024-04-02 11:54:13 +00:00
drh
52f77ff914 Fix a duplicate assert() caused by the second cherrypick in the previous
check-in.

FossilOrigin-Name: f10d4fc4a8fe439e58f35b94322229394229c8f3e15b572c2928402df7d30d90
2023-11-29 16:26:31 +00:00
drh
214750470c Remove Window objects from the corresponding Select.pWin list when they are
deleted, as they are, for example, when the ORDER BY clause is optimized out.

FossilOrigin-Name: f9c6e6a7102689b2a5cf32996a02853e346bcebaed6af0265a7422260fa3358c
2023-11-29 16:07:59 +00:00
drh
c5ca195873 Ensure that when an ephemeral cursor is reopened with a second invocation of to OP_OpenEphemeral, the sequence counter is reset and the cache marked as stale. Fix for [9cdc5c46].
FossilOrigin-Name: d4bfa8d21a3eb8eb734b49057237936140726c67523bf99fc96e7037ab21d3b8
2023-10-19 21:05:31 +00:00
drh
ad856bbc33 Drop support for the view-scan optimization as
it was causing multiple performance regressions.  In its place, reduce the
estimated row count for DISTINCT subsqueries by a factor of 8.

FossilOrigin-Name: 796a65fa61373b5def9bf94e068e2dae9381a084c7e2c1e5df26929e9b07ca07
2023-09-15 20:04:31 +00:00
drh
2a096284b3 In the [/info/7c2d3406000dc8ac|omit-unused-subquery-columns optimization], be
sure to remove the EP_Skip and EP_Unlikely flags from the result set expressions
that get nulled-out.  dbsqlfuzz bf1d3ed6e0e0dd8766027797d43db40c776d2b15.
Also fix an incorrect ".selecttrace" code block.

FossilOrigin-Name: 83a7f13edb74c95f0bccafb931e612ecca568211c3e720db168bd1ff32b3181a
2023-02-26 11:52:37 +00:00
drh
a3ca51cd1b Fix an #ifdef that uses a different macro name from the main branch.
FossilOrigin-Name: ad6ac5d3e84cf7f32378a45f276dd331d6fbac8a102d700c44c2167080fb6a1c
2023-02-16 21:01:33 +00:00
drh
a524a71639 Back-port omit-unused-subquery-column enhancements into the 3.28 branch.
FossilOrigin-Name: 57a4e91f4343b612c346a4d284c0354deee364f83951e64b009e79cd20aedb47
2023-02-16 19:04:40 +00:00
drh
8b6f313f25 Do not compute result columns of subqueries that are never used. Make those columns NULL instead. This optimization potentially resolves the enhancement request described by [baa5bb76c35a124c|ticket baa5bb76c35a124c].
FossilOrigin-Name: 0163b697dd560b6ad78ae20b3ae495a051680b0faf1633827119db381869351f
2023-02-16 14:29:04 +00:00
drh
6945ba787f Fix the subquery result column NULL-ifier so that it correctly handles
subquery columns past the 63rd column.

FossilOrigin-Name: 77b220a7240425fa83e142ceef78505208e6e38d797070e146b9f7d255f753c7
2023-02-15 19:53:08 +00:00
drh
e3ec00ccb8 Do not compute result columns of subqueries that are never used. Make those
columns NULL instead.  This optimization potentially resolves the enhancement
request described by [/tktview/baa5bb76c35a124c|ticket baa5bb76c35a124c].

FossilOrigin-Name: 5dec3cc0225296a043d17f73126d477d90a604f82b3180628176d8f950adbce8
2023-02-15 17:53:17 +00:00
dan
bdb2ec409a Update testrunner.tcl to run zipvfs test scripts on unix.
FossilOrigin-Name: e6c8e19ab0d6e7526d4596b75a45bb6becaf3c029690f7e75c016eac803c9990
2023-02-14 18:09:40 +00:00
drh
d6ba4252b2 Ignore extra parentheses around a subquery on the RHS of an IN operator,
because that is what PostgreSQL does.

FossilOrigin-Name: ecdeef43b27412b0b0b09e09a62ad3a03836a3fc80f2070268090e7ca8f02712
2023-02-13 19:32:40 +00:00
drh
b4dc263ec5 Do not allow WHERE clause terms to match constant string index terms, which
can happen if DQS_DDL is enabled.  Follow-up to
[44200596aa943963].  dbsqlfuzz 54c9db85ed4af7055f5fd0d50877875c82b11d46.

FossilOrigin-Name: 2d2b91cc0f6fed8cb6f738dc7019047ce0f1e86b5eb8efa997095d08a32cbcb6
2023-02-13 18:42:01 +00:00
dan
1aacb3b02f Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
FossilOrigin-Name: 18a99d9cfbc3a0419342b3fe91a83d2217578d0f6e8ee1084237d000946b1942
2023-02-13 18:37:48 +00:00
dan
5c84aafd77 Fix compile time option SQLITE_DEFAULT_SYNCHRONOUS so that it works consistently.
FossilOrigin-Name: bf6f1ee77c4bf653f6cd2a3db5292b8c5c83f18ea9acf951107d22807546b28a
2023-02-13 18:26:58 +00:00
dan
0c69938511 Allow vector-IN expressions like "(a, b) IN ( (?,?), (?,?) )" to use an index.
FossilOrigin-Name: 1815b15ddb8785a25b7617aab19e13c2410b9377389c16a85176025b3d9400e8
2023-02-13 16:10:31 +00:00
drh
9e463e878d In the LIKE optimization, do not analyze the new virtual WHERE clause terms
until both have been added, since they are expected to be consecutive and
the analysis might add complementary terms.
This fixes a problem caused by [44200596aa943963] and discovered by dbsqlfuzz
and recorded as case 7e3b5983727d843b910b2d9ab556e4afcd777cfb.

FossilOrigin-Name: d35de3ad3fac6b30d3f266cbe4b1e9923eb31a1eff4a869205bbc3ba122eeec5
2023-02-13 12:46:22 +00:00
drh
0c55b5fd1c Change a variable from 32 to 64-bits to avoid a harmless compiler warning
in Xcode.  [forum:/forumpost/402d733c22|Forum post 402d733c22].

FossilOrigin-Name: 0216ce23cf23bc147c5de6de178a6689b7ad744bf0ee0098809938b5fe10708b
2023-02-11 21:11:39 +00:00
drh
80e936aef0 Do a better job of detecting when a WHERE clause term might be useful to
an expression index.  Fix for performance regression reported by
[forum:/forumpost/e65800d8cb|forum thread e65800d8cb].

FossilOrigin-Name: 44200596aa943963bc6ca98b5d4fd5b9235d1109d8dfc1a75eeae353b4239142
2023-02-10 21:53:33 +00:00
dan
a3e6192941 Fix a problem with the fts5 trigram tokenizer and LIKE or GLOB patterns for which contain runs of 2 or fewer non-wildcard characters that are 3 or more bytes when encoded as utf-8.
FossilOrigin-Name: 00714b39b39c51519edbc0194f98c7275fecf96763a06fd95db6e1d81bb9f1f1
2023-02-10 17:17:04 +00:00
drh
74e6e30358 Ensure that the valueFromFunction() routine does not clear a prior
parser error.  dbsqlfuzz 6fa816f20cf5b62260d635d110b88f38e29d8fe1.

FossilOrigin-Name: 734766451123c98a467c3407562eaa097b3307c8a275e1c8dd93e4654fe78014
2023-02-10 14:20:18 +00:00
stephan
98094e2f4c Minor text-only updates to wasm demo/test HTML and license header.
FossilOrigin-Name: f28e2a8613571fe3c23bfbbb602311071f4cb9731653216cfe436c38b0a59736
2023-02-10 11:05:16 +00:00
stephan
c9e3cbe873 Fix ext/wasm/fiddle build, which was silently broken by recent build refactoring.
FossilOrigin-Name: dcf532931136d09bef23ccad669d486cb31daec8565317c3209c280b5695d45d
2023-02-10 11:04:39 +00:00
drh
3f4795a391 Disable the double-quoted string misfeature by default in CLI builds.
DQS can be reenabled at run-time using the ".dbconfig dqs_dml" and
".dbconfig dqs_ddl" dot-commands.

FossilOrigin-Name: c995932c3ffe7f2710ebce0fa407eca3200418aa84febc15fb15f20f3758a98d
2023-02-09 15:32:24 +00:00
stephan
5b56a13977 Squelch two harmless signedness comparison warnings in shell.c.in.
FossilOrigin-Name: bdd3edec13fa1142a8074c316e9ecec93fb278d42836eeb38587376fdf22cebd
2023-02-09 12:59:44 +00:00
drh
9a8330b550 New test cases added to fuzzdata8.db.
FossilOrigin-Name: be67bafccd79ba835ed7e287e09852ce83805da0797b164d0c8e44be05d9d28a
2023-02-09 12:47:15 +00:00
drh
a0c8ec9ee5 The "flexnum" affinity that was added by [44135d6ea84f7ba6] needs to also
be added to the output of the affinity() built-in function.
dbsqlfuzz d309eaa5fe492c9606a8be876c2bc7dedb29d3d8

FossilOrigin-Name: f4ec68ceefa3a607f37d6355aac89fd1ae1704da4061bad7f271db1f17c1dd3a
2023-02-09 11:51:40 +00:00
drh
601e4d4a0f Back out the 'txn' enhancement to date/time functions. The duration of a
"transaction" is confused and needs to be straightened out prior to moving
forward with this change.

FossilOrigin-Name: 4a145f07322d768a07619bed27e0390d50f3a01d07787b9296234a5ceb6f1218
2023-02-08 20:29:48 +00:00
drh
03b30b7abe Always use 64-bit integers for stats associated with STAT1 and STAT4.
FossilOrigin-Name: 6647d1cb8b53102c8114b1f3e34173d907504d78aa3140eab53f88027a36660b
2023-02-08 17:28:42 +00:00
dan
0d12a79310 Better fix the problem where optimizing an fts5 table too often causes it to become unreadable (first attempt was [35bed981]).
FossilOrigin-Name: 459d986d38fc0ccbfd66801e0f22900cfed831268cf59ac8d1cd1e556f0d1441
2023-02-08 17:28:08 +00:00
larrybr
72ce57e675 Cause gcc warning suppression in shell.c to be nice in other project(s).
FossilOrigin-Name: 6b41ba2e996ab7b9c3943ab93a19748db5cf37792f5d59d20eec301085282355
2023-02-08 14:49:52 +00:00
dan
8ae1d29b13 Update an assert() in the stat4 code that is only true for a well-formed database.
FossilOrigin-Name: 04439f3b23b22a3c187637f286764568ee922227e3e34b2e63075876b4d1f2ac
2023-02-08 14:25:00 +00:00
drh
0873d88423 Fix an incorrect assert() in STAT4 logic added just a few days ago on
[2023-02-01|/info/55a26c67ed4a3a93].

FossilOrigin-Name: 168fa2fb22b8c1ad80c7001a429d3a80b48acfbfebb5414a0caa76964ea647c3
2023-02-08 14:17:34 +00:00
drh
821fe31fd7 Add the 'txn' date/time format. Change CURRENT_TIMESTAMP and similar to use
'tnx'-style semantics instead of 'now'-style.

FossilOrigin-Name: 61cc8ed8d3541eddf23a9d542179c3f0223c5b8519b54d3be79988a376e25a89
2023-02-08 12:47:37 +00:00
drh
159cbfe1cb Test cases to show that CURRENT_TIMESTAMP and similar hold the same value
across a transaction.

FossilOrigin-Name: 7b2fa20e31b8a0314b9ccb97bb556898d552505dbc5943f248df3f86c0f4e008
2023-02-08 12:31:47 +00:00
drh
ed092fc368 Revert the behavior of date/time functions with no arguments so that they
once again work like 'now', even while CURRENT_TIMESTAMP and similar work
like 'txn'.

FossilOrigin-Name: 06180caff0f5d8aba83b9f7be682ccdd6cb2ffc228b557ee6c1fd00fe5c23e92
2023-02-08 12:01:48 +00:00
drh
c1dab9ded2 Change the behavior of date-time functions without any arguments (and thus
the CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP variables) so that they
work like 'txn' instead of like 'now'.  This is an incompatibility with legacy,
but brings SQLite into conformance with all other SQL systems.

FossilOrigin-Name: 1ac78be54502779236645eac35b962797f2fb98307d059d2aa19658c4fa74cb7
2023-02-08 11:34:05 +00:00
stephan
51b0373998 Merge wasi-patches branch into trunk.
FossilOrigin-Name: 9902e66a37d59c1909593bbc296091df3fa3bfa12ec7062bd84e458030f77c8d
2023-02-08 08:49:52 +00:00
drh
3393ee7ff6 Simplify the code and add test cases.
FossilOrigin-Name: d3bed4caff561e71c396cc869c5b4d9bf216ba203485e738c12ec62741f1aba5
2023-02-07 23:55:59 +00:00
drh
d4af882a1b Add support for the 'txn' argument to date/time functions that works like
'now' but keeps the same time for the entire transaction.

FossilOrigin-Name: 5e4f45af96247e29910403a63ac148cb313b005f9c014b37a9a49d98f5fef9a6
2023-02-07 21:55:14 +00:00
dan
c3ea539dc2 Fix a test script problem causing "make test" to fail for non-RBU builds.
FossilOrigin-Name: 2abc3f9de0d2b66342598ab9015e62568ed20c7da4744a0f0a76b1db72c7e941
2023-02-07 18:41:23 +00:00
drh
9d6725c651 Fix a typo in example documentation code for sqlite3_vtab_in_next().
FossilOrigin-Name: a95dbfae6133cc7aac950c3e7ba55a29d80b1625c39479a7d1d10b0868ee2be4
2023-02-07 16:58:58 +00:00