-
-
Notifications
You must be signed in to change notification settings - Fork 90
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
Eliminate remaining repeat_vars()
calls
#6359
Comments
iequidoo
added a commit
that referenced
this issue
Dec 31, 2024
Using `repeat_vars()` to generate SQL statements led to some of them having more than `SQLITE_MAX_VARIABLE_NUMBER` parameters and thus failing, so let's get rid of this pattern. But let's not optimise for now and just repeat executing an SQL statement in a loop, all the places where `repeat_vars()` is used seem not performance-critical and containing functions execute other SQL statements in loops. If needed, performance can be improved by preparing a statement and executing it in a loop. An exception is `lookup_chat_or_create_adhoc_group()` where `repeat_vars()` can't be replaced with a query loop, there we need to replace the `SELECT` query with a transaction creating a temporary table which is used to perform the SELECT query then. Not good that a read transaction is replaced with a write one, but `lookup_chat_or_create_adhoc_group()` is a heavy function anyway which calls `create_adhoc_group()`, so this shouldn't affect performance a lot.
iequidoo
added a commit
that referenced
this issue
Jan 5, 2025
Using `repeat_vars()` to generate SQL statements led to some of them having more than `SQLITE_MAX_VARIABLE_NUMBER` parameters and thus failing, so let's get rid of this pattern. But let's not optimise for now and just repeat executing an SQL statement in a loop, all the places where `repeat_vars()` is used seem not performance-critical and containing functions execute other SQL statements in loops. If needed, performance can be improved by preparing a statement and executing it in a loop. An exception is `lookup_chat_or_create_adhoc_group()` where `repeat_vars()` can't be replaced with a query loop, there we need to replace the `SELECT` query with a read transaction creating a temporary table which is used to perform the SELECT query then.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#6358 removes some uses of it, but other uses are difficult to eliminate.
#6355 proposes using temporary tables.
Instead of
IN (?, ?, ?, ...)
it is possible to open a transaction, create a temporary table, populate it with needed values in a loop, then select from it usingIN (SELECT * FROM temp_table)
.The text was updated successfully, but these errors were encountered: