[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#69292] [PATCH 4/6] store: database: Stop finalizing prepared statem
From: |
reepca |
Subject: |
[bug#69292] [PATCH 4/6] store: database: Stop finalizing prepared statements. |
Date: |
Thu, 22 Feb 2024 06:39:37 -0600 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Christopher Baines <mail@cbaines.net> writes:
> Especially since we're asking for these to be cached.
>
> Management of prepared statements isn't trivial, since you don't want to keep
> them forever as this can lead to poor query performance, but I don't think
> that finalizing them immediately is the right solution.
guile-sqlite3 arranges for cached statements to only be reset, not
finalized, when sqlite-finalize is called on them (see
https://notabug.org/guile-sqlite3/guile-sqlite3/src/master/sqlite3.scm.in#L283).
The idea behind this admittedly-unintuitive behavior is that it allows
for the caching behavior of a statement to be decided independently of
the code that actually uses it: if it's been decided elsewhere that a
prepared statement is worth keeping around, it will reuse it, but if it
hasn't, it will still properly clean up what it created.
Perhaps reusing the name 'sqlite-finalize' to make that behavior
transparent wasn't the best choice in the long run.
I hope that makes the way it was written a bit less baffling.
- reepca
signature.asc
Description: PGP signature