Replies: 1 comment 3 replies
-
Hello again, @Jnosh! Oh, I suppose you are talking about concurrent read transactions. Good catch!
Sure! As you say, this won't prevent other connections from messing with the vacuum, but at least The vacuum doc should be updated: /// Rebuilds the database file, repacking it into a minimal amount of
/// disk space.
///
+/// The vacuum is not executed until all currently executing
+/// database accesses finish executing (both reads and writes).
+/// At that point, the vacuum is executed. Once done, other
+/// database accesses can proceed.
///
/// Related SQLite documentation: <https://www.sqlite.org/lang_vacuum.html>
I do not know. I lack experience with VACUUM. As long as it is possible to go low level, we can leave this question up to the support: try writer.writeWithoutTransaction { try $0.execute(sql: "VACUUM") } |
Beta Was this translation helpful? Give feedback.
-
The
DatabaseWriter.vacuum()
andDatabaseWriter.vacuum(into:)
methods currently execute outside of a transaction as required byVACUUM
by usingwriteWithoutTransaction
.However,
VACUUM
will also fail if there is any ongoing transaction running at the same time.Since
writeWithoutTransaction
is not reentrant we can't simply wrapDatabaseWriter.vacuum()
to ensure there are no ongoing transactions.Would it make sense to use
barrierWriteWithoutTransaction
instead to ensure that no other (GRDB) transactions are taking place?Or is there a need for both versions, i.e. is there a use case for "opportunistic
VACUUM
" where one would want to try toVACUUM
but fail if there are ongoing reads?Beta Was this translation helpful? Give feedback.
All reactions