Skip to content

Async Wrapper #456

Answered by rogerbinns
SamirMishra27 asked this question in Q&A
Discussion options

You must be logged in to vote

SQLite itself is not asynchronous, so any async wrapper would have to send the the work to another thread. You can do this yourself using run_in_executor with a ThreadPoolExecutor.

Have you tried APSW/SQLite synchronously? SQLite is running in process and is highly optimised. The design and implementation tries to get you results as quickly as possible with the lowest time and CPU consumption. I believe that in most cases you'd find the overhead of shuffling work off to another thread dwarfs just using APSW/SQLite synchronously.

My recommendation is to do things synchronously, and then do profiling to find anything that takes too much time on the main thread. For that small number of case…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by SamirMishra27
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants