The VACUUM command does not change the content of the database except the rowid values. To do this, you set new values using pragma and then vacuum the database. The original database file is overwritten.īecause the VACUUM command rebuilds the database, you can use it to change some database-specific configuration parameters such as page size, page format, and default encoding. Then, SQLite copies the content of the temporary database file back to the original database file. This operation defragments the database objects, ignores the free spaces, and repacks individual pages. SQLite first copies data within a database file to a temporary database. ![]() SQLite provides the VACUUM command to address all three issues above. Therefore, it increases the number of pages to hold a table. Because of this, it increases storage overhead for the table, takes more time to read/write, and decreases the cache performance. ![]() It decreases the number of rows that can be stored in a single page. Third, the insert, update and delete operations create unused data block within individual database pages. Second, when you insert or delete data from the tables, the indexes and tables become fragmented, especially for the database that has a high number of inserts, updates, and deletes. As a result, the size of the database file always grows in size. Why do you need SQLite VACUUM commandįirst, when you drop database objects such as tables, views, indexes, and triggers or delete data from tables, the database file size remains unchanged. Because SQLite just marks the deleted objects as free and reserves it for the future uses. Here you see that the last backup ran on Nov 28 at 17:14 and took roughly 10 minutes to complete.Summary: in this tutorial, we will explain why you need to use the SQLite VACUUM command and show how to use it to optimize the database file. Nov 28 17:24:38 my.linux.host systemd: Finished Hot-backup Chia blockchain database. Nov 28 17:24:38 my.linux.host systemd: rvice: Succeeded. Nov 28 17:14:30 my.linux.host systemd: Starting Hot-backup Chia blockchain database. ![]() Loaded: loaded (/home/chia/.config/systemd/user/rvice static vendor preset: enabled)
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |