GGshow reloaded GGshow reloaded

December 31, 2011

VACUUMing SQLite

Issue:

  • SQLite database file size keep increasing.
  • SQLite database file size not reduced after deleted tables or rows.

Reason:

  • In SQLite, when an object (table, index, or trigger) is dropped from the database, it leaves behind empty space. This makes the database file larger than it needs to be, but can speed up INSERT operations. Over time, INSERT and DELETE operations can leave the database file structure fragmented, which slows down disk access to the database contents.

Solution:

  • Use VACUUM command rebuilds the entire database; or
  • enable auto vacuum in the database, use command pragma auto_vacuum.
Filed under: Database,SQLite — Tags: , — GG @ 4:17 pm

No Comments »

No comments yet.

RSS feed for comments on this post.

Leave a comment

© 2024 GGSHOW | Powered by WordPress