Christopher Baines 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