-
-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GVL mode #39
Add GVL mode #39
Conversation
Hey @gschlager would you like to have a look and tell me what you think? Some more thoughts:
|
Overall I like these changes. Though the tests look a bit brittle and it doesn't seem like the tests are able to detect the difference between I kinda like the idea of having a I'd say having the setting on the DB instead of globally is a good choice. I can imagine a use case where an app switches between single and multithreading and in that case it might make sense to configure this on the DB connection level instead of globally. |
I agree. I couldn't find a way to make SQLite sleep or make a long calculation on each row. Any idea? |
Unfortunately not. I tried a couple of things, but |
@dbackeus shared this technique with me for getting SQLite to "sleep": -- Since SQLite doesn't have a sleep function, we'll use a recursive CTE
-- which takes approximately 1 second to execute.
WITH RECURSIVE r(i) AS (
VALUES(0)
UNION ALL
SELECT i FROM r
LIMIT 10000000
)
SELECT i FROM r WHERE i = 1; |
Closed in favor of #46. |
In response to #38, this PR adds three different GVL modes for use when running queries:
:hybrid
- the GVL is released when preparing a stmt, when fetching the first record, and held on subsequent records. This is the default mode.:release
- the GVL is released when preparing a stmt and on fetching each record.:hold
- the GVL is held while preparing a stmt and fetching records.The backup API always releases the GVL while backing up the DB.