You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use json_each to make SQLite single inserts batch inserts (#1276)
Back when I was first implementing SQLite, the sqlc support was so
catastrophically bad that many, many basic utilities just could not be
used in queries. I tried like a half dozen different ways, but couldn't
find anything that was both supported by SQLite and sqlc, so I ended up
making a number of batch inserts into single inserts that get looped
over in the driver. This isn't as bad in SQLite because usually your
inserting to a local database (i.e. no network connections), but it's
still not ideal in that it's probably somewhat slower, and deviates from
the Postgres implementation.
Sqlc's made some SQLite improvements since then, and I found that I'm
now able to get a batch insert working `json_each` and `json_extract`.
Here, go through the existing SQLite driver function and update things
to use batch inserts wherever possible. Fixed operations:
* `JobInsertFastMany`
* `JobInsertFastManyNoReturning`
* `JobInsertFullMany`
* `MigrationInsertMany`
* `MigrationInsertManyAssumingMain`
Copy file name to clipboardExpand all lines: CHANGELOG.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
8
8
## [Unreleased]
9
9
10
+
### Changed
11
+
12
+
- Change SQLite driver operations over to use bulk inserts where possible now that sqlc has better support for `json_each`. [PR #1276](https://github.com/riverqueue/river/pull/1276)
13
+
10
14
### Fixed
11
15
12
16
- Fix `JobCancel` having no effect on running jobs when using a poll-only driver (e.g. `riverdatabasesql`). The `controlActionCancel` event was silently dropped in `fetchAndRunLoop`'s `queueControlCh` handler instead of being forwarded to `maybeCancelJob`. Note: this fix only works within a single process; cross-process cancels in poll-only setups must wait for the next poll cycle. [PR #1245](https://github.com/riverqueue/river/pull/1245).
0 commit comments