Skip to content

Commit

Permalink
Search.disable() should delete sqlite_stat* tables before vacuuming. #…
Browse files Browse the repository at this point in the history
  • Loading branch information
maksverver committed Aug 28, 2024
1 parent 63e8ec3 commit 61e3c58
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/reader/_storage/_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ def disable(self) -> None:
# However, we at least minimize the space they take using VACUUM.

if self.path:
# Delete any internal tables that may have been created with
# ANALYZE or indirectly via PRAGMA OPTIMIZE.
#
# For more information, see:
# - https://github.com/lemon24/reader/issues/348
# - https://sqlite.org/forum/forumpost/5414ca8f89389f8a
db.execute("DROP TABLE IF EXISTS search.sqlite_stat1;")
db.execute("DROP TABLE IF EXISTS search.sqlite_stat2;")
db.execute("DROP TABLE IF EXISTS search.sqlite_stat3;")
db.execute("DROP TABLE IF EXISTS search.sqlite_stat4;")

# Now the database should be empty. VACUUM to reclaim space.
db.execute("VACUUM search;")

@classmethod
Expand Down

0 comments on commit 61e3c58

Please sign in to comment.