Commit Graph

2529 Commits

Author SHA1 Message Date
Pekka Enberg
26e5496c19 Merge 'Fix autoindex of primary key marked as unique' from Pere Diaz Bou
Primary keys that are marked as unique constraint, do not need to have
separate indexes, one is enough. In the case primary key is integer,
therefore rowid alias, we still need an index to satisfy unique
constraint.

Closes #1494
2025-05-17 08:02:04 +03:00
Pekka Enberg
eb757436b2 Merge 'pager: bump default page cache size from 10 to 2000 pages' from Jussi Saurio
```
Execute `SELECT count() FROM users`/limbo_execute_select_count
                        time:   [12.867 µs 12.958 µs 13.104 µs]
                        change: [-91.233% -91.178% -91.120%] (p = 0.00 < 0.05)
                        Performance has improved.
```
also extracted it to a constant

Closes #1498
2025-05-16 16:32:33 +03:00
Jussi Saurio
416de9dd9c Extract page cache size constant and bump to 2k 2025-05-16 15:40:19 +03:00
Pere Diaz Bou
82e5597b00 long fuzz tests ci on btree changes
The idea is simple, if you modify the btree, we should verify fuzz tests
with long number of iterations to decrease the chance of a regression
2025-05-16 11:26:00 +02:00
Pere Diaz Bou
36dd5b9704 fmt 2025-05-16 09:06:44 +00:00
Pere Diaz Bou
45412a394f add another test with >1 indexes 2025-05-16 10:37:04 +02:00
Pere Diaz Bou
74328f2617 fix allocation of indices BTreeCreate registers
For some reason we always allocated one more index than required when we
had `total_indices>1`.
2025-05-16 10:37:04 +02:00
Pere Diaz Bou
ff524d037d fix autoindex of primary key marked as unique
Primary keys that are marked as unique constraint, do not need to have
separate indexes, one is enough. In the case primary key is integer,
therefore rowid alias, we still need an index to satisfy unique
constraint.
2025-05-16 10:37:04 +02:00
Jussi Saurio
b16044f34b pager: bump default page cache size from 10 to 1000 pages
```
Gnuplot not found, using plotters backend
Execute `SELECT count() FROM users`/limbo_execute_select_count
                        time:   [12.867 µs 12.958 µs 13.104 µs]
                        change: [-91.233% -91.178% -91.120%] (p = 0.00 < 0.05)
                        Performance has improved.
```
2025-05-16 09:23:42 +03:00
Pekka Enberg
a6270e8a6c Merge 'Add libsql_wal_frame_count() API' from Pekka Enberg
Reviewed-by: Pere Diaz Bou <pere-altea@homail.com>

Closes #1489
2025-05-15 12:01:45 +03:00
Pekka Enberg
2127de3422 cargo fmt 2025-05-15 12:00:55 +03:00
Pekka Enberg
524a523036 sqlite3: Add libsql_wal_frame_count() API 2025-05-15 11:43:44 +03:00
Pekka Enberg
9303262dfd OwnedValue -> Value 2025-05-15 11:43:23 +03:00
Pere Diaz Bou
ef65275bda Merge 'test page_free_array' from Pere Diaz Bou
Simply add a fuzz test to test free_array works as intended

Reviewed-by: Jussi Saurio <jussi.saurio@gmail.com>

Closes #1480
2025-05-15 10:19:09 +02:00
Pekka Enberg
e3f71259d8 Rename OwnedValue -> Value
We have not had enough merge conflicts for a while so let's do a
tree-wide rename.
2025-05-15 09:59:46 +03:00
pedrocarlo
9fc9415b20 use Jussi's code to avoid cloning immutable record 2025-05-14 13:30:39 -03:00
pedrocarlo
72cc0fcdcb fixes and comments 2025-05-14 13:30:39 -03:00
pedrocarlo
b2615d7739 add CursorValidState and only save context in delete when rebalancing 2025-05-14 13:30:39 -03:00
pedrocarlo
814508981c fixing more rebase issues and cleaning up code. Save cursor context when calling delete for later use when needed 2025-05-14 13:30:39 -03:00
pedrocarlo
c69f503eac rebase adjustments 2025-05-14 13:30:39 -03:00
pedrocarlo
05f4ca28cc btree rewind and next fix. Keep track of rowids seen to avoid infinite loop 2025-05-14 13:30:39 -03:00
pedrocarlo
c146877344 add sqlite debug cli for nix. Fix cursor delete panic. Add tracing for cell indices in btree 2025-05-14 13:30:39 -03:00
pedrocarlo
6588004f80 fix incorrectly detecting if user provided row_id_alias to set clause 2025-05-14 13:30:39 -03:00
pedrocarlo
482634b598 adjust null opcode emission based in rowid_alias 2025-05-14 13:30:39 -03:00
pedrocarlo
758dfff2fe modified tests as we do not have rollback yet. Also correctly raise a contraint error on primary keys only 2025-05-14 13:30:39 -03:00
pedrocarlo
3aaf4206b7 altered constraint tests to create bad update statements. Tests caught a bug where I was copying the wrong values from the registers 2025-05-14 13:30:39 -03:00
pedrocarlo
cf7f60b8f5 changed from resolve_label to preassign_label 2025-05-14 13:30:39 -03:00
pedrocarlo
6457d7675a instruction emitted should be correct, but having an infinite loop bug 2025-05-14 13:30:39 -03:00
pedrocarlo
60a99851f8 emit NoConflict and Halt. Already detects unique constraints 2025-05-14 13:30:39 -03:00
pedrocarlo
5f2216cf8e modify explain for MakeRecord to show index name 2025-05-14 13:30:39 -03:00
pedrocarlo
9aebfa7b5d open cursors for write only once 2025-05-14 13:30:39 -03:00
pedrocarlo
5bae32fe3f modified OpenWrite to include index or table name in explain 2025-05-14 13:30:39 -03:00
pedrocarlo
e7fa023c26 Adding indexes to the update plan 2025-05-14 13:30:39 -03:00
pedrocarlo
4dc1431428 handling edge case when passing duplicate a multi-column unique index 2025-05-14 11:46:24 -03:00
pedrocarlo
ea15b1f617 extract primary key detection 2025-05-14 11:34:39 -03:00
pedrocarlo
b93156ee9d simplify unique sets creation 2025-05-14 11:34:39 -03:00
pedrocarlo
e75e20c9e9 fix incorrect matching in column name 2025-05-14 11:34:39 -03:00
pedrocarlo
5dee1adab8 panic when on_conflict is specified for Unique constraint 2025-05-14 11:34:39 -03:00
pedrocarlo
e7d0962a6c adjust order of indices and add tests 2025-05-14 11:34:39 -03:00
pedrocarlo
3526a206e4 support Unique properly by creating a vec of auto indices 2025-05-14 11:34:39 -03:00
pedrocarlo
c5f004c1d6 added test and adjustments 2025-05-14 11:34:39 -03:00
pedrocarlo
e4ca1bb55e modify automatic index creation to account for unique columns 2025-05-14 11:34:11 -03:00
pedrocarlo
bb158a5433 add unique field to Column 2025-05-14 11:34:11 -03:00
pedrocarlo
002acbb9dc add check for unique contraint in auto index creation 2025-05-14 11:34:11 -03:00
Pere Diaz Bou
5025655f75 debug assertions 2025-05-14 13:53:51 +02:00
Pere Diaz Bou
c3432e1cc3 fmt 2025-05-14 13:23:12 +02:00
Pere Diaz Bou
13a120530e comment shift_cells_left
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-14 13:20:11 +02:00
Pere Diaz Bou
0d8a94d49d expect parse seed in rng_from_time_or_env
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-05-14 13:19:20 +02:00
Pere Diaz Bou
34c74e34d9 test page_free_array
Simply add a fuzz test to test free_array works as intended
2025-05-14 12:48:59 +02:00
Jussi Saurio
176d9bd3c7 Prune bad plans earlier to avoid allocating useless JoinN structs 2025-05-14 09:42:26 +03:00