Synchronous queries to SQLite?
Is there any way to make synchronous queries to SQLite? As I understand it,
better-sqlite3
is a synchronous library and Kysely's SQLite dialect uses better-sqlite3
, so is there a way to make synchronous queries?Solution:Jump to solution
There's no way to do that. The only dialect where a synchronous API would make sense is sqlite and we'd need to add a synchronous alternative of EVERYTHING for that tho work.
If I'm not mistaken, the reason why better-sqlite3 is faster is that it's synchronous internally greatly reducing mutex thrashing. We're just wrapping that same API to a couple of layers of async javascript code. I haven't run any performance benchmarks, but the performance might not be affected too much....
1 Reply
Solution
There's no way to do that. The only dialect where a synchronous API would make sense is sqlite and we'd need to add a synchronous alternative of EVERYTHING for that tho work.
If I'm not mistaken, the reason why better-sqlite3 is faster is that it's synchronous internally greatly reducing mutex thrashing. We're just wrapping that same API to a couple of layers of async javascript code. I haven't run any performance benchmarks, but the performance might not be affected too much.