Skip to content

Commit

Permalink
Make sure we freeup unused pages in sqlite
Browse files Browse the repository at this point in the history
This commit adds changes to make sure that we force sqlite3 to give up space which has accumulated over time by deletions of entries. What sqlite3 does is that each data which is removed from the database, sqlite3 does not use the space consumed by that payload and instead moves it to it's list of free pages and whenever more data is added it uses these free pages first and then asks for more space. However with time these free pages can consume lots of space like for a user his db size was 15 mb approx and after vacumming it got to 706K. This change uses vacuum functionality of sqlite3 to make sure that we remove such free unused pages which are in hold by sqlite3.
  • Loading branch information
sonicaj committed Aug 13, 2021
1 parent 317e134 commit 6951ca4
Showing 1 changed file with 1 addition and 0 deletions.
Expand Up @@ -42,6 +42,7 @@ def _setup(self):
self.connection = self.engine.connect()
self.connection.connection.create_function("REGEXP", 2, regexp)
self.connection.connection.execute("PRAGMA foreign_keys=ON")
self.connection.connection.execute("VACUUM")

@private
async def execute(self, *args):
Expand Down

0 comments on commit 6951ca4

Please sign in to comment.