drh [Tue, 3 Feb 2026 17:21:59 +0000 (17:21 +0000)]
Improve the query planner by reducing the estimated number of output rows
for each stage of a join if there are LIKE, GLOB, REGEXP, or MATCH
constraints on the table where the pattern string is a constant. The
reduction in the output row estimate is proportional to the length of
the pattern string.
drh [Tue, 3 Feb 2026 14:00:28 +0000 (14:00 +0000)]
Refactor the implementation of this enhancement to keep all the code inside
the query planner, not leaking out into SQL function implementations.
Expand the enhancement to cover MATCH and REGEXP operators and overloads
of LIKE and GLOB.
drh [Sun, 1 Feb 2026 15:58:37 +0000 (15:58 +0000)]
Enhance the ".timer" command in the CLI to accept the "once" argument, and
so that it leaves its last real-time result in the $TIMER variable. Also
fix a harmless warning from an earlier check-in.
drh [Sun, 1 Feb 2026 00:37:04 +0000 (00:37 +0000)]
An experimental query-planner change that reduces the estimated number
of output rows for FROM clause terms that are restricted by a LIKE or
GLOB operator, based on the number of bytes in the pattern. The idea is
that longer patterns will match fewer records and hence should reduce the
estimated output count. The implementation is not workable as it stands
now. This is just a crazy idea, saved for future reference.
drh [Sat, 31 Jan 2026 02:17:55 +0000 (02:17 +0000)]
Fix a missed optimization opportunity due to a typo in check-in [898bfa1afd8260ea].
Reported by [forum:/forumpost/2026-01-31T00:49:53z|forum post 2026-01-31T00:49:53z].
drh [Fri, 30 Jan 2026 17:10:22 +0000 (17:10 +0000)]
Make CROSS JOIN a join reorder barrier again, as the SQLite documentation says it is. It
mistakenly stopped being a join barrier with check-in [c1ea064948ba08c4].
drh [Fri, 30 Jan 2026 13:11:20 +0000 (13:11 +0000)]
Change the new escape-character mechanism for CSV import so that there are
separate options for an escape character for quoted and unquoted fields of
the CSV.
stephan [Fri, 30 Jan 2026 06:37:34 +0000 (06:37 +0000)]
kvvfs fix for [https://github.com/sqlite/sqlite-wasm/issues/146|npm ticket #146]: use of a test-mode-only symbol in non-test runs leads to a null deref in xFileControl().
stephan [Wed, 28 Jan 2026 17:25:18 +0000 (17:25 +0000)]
Capture sqlite3_rsync's remote-end result code so the local side can exit with non-0 if, e.g., the remote sqlite3_rsync binary is found but fails to start. [forum:43eb1cd1c3979817|Confirmation received] that it resolves the motivating problem report.
drh [Tue, 27 Jan 2026 23:33:42 +0000 (23:33 +0000)]
Avoid unsigned integer overflow when evaluating an array index in a
JSON path expression.
[forum:/forumpost/2026-01-27T14:18:49z|Forum post 2026-01-27T14:18:49z].
drh [Tue, 27 Jan 2026 16:18:35 +0000 (16:18 +0000)]
The tmstmpvfs.c extension should not modify the content of pages going into
the WAL file, as that would corrupt the page checksum used for recovery.
Instead, only insert timestamp information as content is written into the
database file.
stephan [Tue, 27 Jan 2026 16:15:22 +0000 (16:15 +0000)]
Teach sqlite3_rsync to increment its error count when a child process fails, based on [forum:8fe404e547faa42e|forum post 8fe404e547faa42e]. This passes basic sanity tests but requires more testing and needs a review of the final 'else' block in the new code.
drh [Tue, 27 Jan 2026 14:59:08 +0000 (14:59 +0000)]
For CSV import in the CLI, when the table is created automatically
because it does not previously exist, make the column types "ANY"
instead of "TEXT" so that they will automatically adjust to different
datatypes in the input text.
drh [Mon, 26 Jan 2026 21:20:28 +0000 (21:20 +0000)]
Enhancements to tmstmpvfs.c: (1) Use the exact same timestamp on logfile
entries as on the pages that control, where appropriate. (2) Include the
WAL frame number in ELOG_CKPT_PAGE logfile entries.
drh [Sun, 25 Jan 2026 15:18:31 +0000 (15:18 +0000)]
Fix the jsonb_group_array() and jsonb_group_object() functions so that they return
JSONB as they should, and not text JSON, when the array or object is empty.
[forum:/forumpost/2026-01-25T00:47:06z|Forum post 2026-01-25T00:47:06z].
drh [Sat, 24 Jan 2026 17:18:56 +0000 (17:18 +0000)]
Assert() statements added to sqlite3_result_text64() and
sqlite3_bind_text64() to detect misuse of SQLITE_UTF8_ZT that can
result in undefined behavior.
stephan [Sat, 24 Jan 2026 01:17:06 +0000 (01:17 +0000)]
Expose SQLITE_UTF_ZT to WASM for completeness's sake, but the WASM build does not expose sqlite3_bind_text64() or sqlite3_result_text64() because it only supports UTF8 encoding, so ZT does not currently have a genuine use there.
drh [Fri, 23 Jan 2026 20:46:54 +0000 (20:46 +0000)]
In the cost metrics of the query planner, the estimated number of output rows
from an EXISTS-to-JOIN loop should not be more than 1.
[forum:/forumpost/989880d0aa|Forum post 989880d0aa].
drh [Fri, 23 Jan 2026 00:55:36 +0000 (00:55 +0000)]
Add the SQLITE_UTF8_ZT value which can be the encoding argument to
sqlite3_result_text64() or sqlite3_bind_test64() to indicate that the
argument is UTF-8 text that is zero-terminated.
drh [Thu, 22 Jan 2026 19:02:32 +0000 (19:02 +0000)]
Enhance the [/info/e33da6d5dc964db8|EXISTS-to-JOIN optimization] so that
the inserted JOIN terms are not required to be on the inner-most loops,
as long as all dependencies for the EXISTS-to-JOIN loops are in outer
loops. This addresses the performance concern of
[forum:/forumpost/2026-01-21T19:49:04z|forum post 2026-01-21T19:49:04z].
Test cases in TH3.
drh [Wed, 21 Jan 2026 19:24:07 +0000 (19:24 +0000)]
Add a new encoding constant SQLITE_UTF8_ZT, which if used with
sqlite3_result_text64() or sqlite3_bind_text64() declares that the
string provided is UTF8 and zero-terminated at the length specified.
stephan [Tue, 20 Jan 2026 17:10:22 +0000 (17:10 +0000)]
wasm: a potential workaround for cases such as [forum:1eec339854c935bd|forum post 1eec339854c935bd], where client-local needs require overriding Emscripten config defaults (which we very intentionally do not document or support for reasons explained in that thread). This is untested because it requires a special-needs setup, but it doesn't break anything for run-of-the-mill cases.