K
Kysely4mo ago
psm

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:
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....
Jump to solution
1 Reply
Solution
koskimas
koskimas4mo ago
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.
Want results from more Discord servers?
Add your server