SQLite - SPLessons

SQLite Vacuum

Chapter 21

SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

SQLite Vacuum

Vacuums

shape Description

SQLite Vacuum command cleans the primary database by replicating its substance to a temporary database records and reloading the first database document from the duplicate. This dispenses with free pages, adjust table information to be adjoining, and generally tidies up the database structural records.

SQLite VACUUM summon just takes a shot at the fundamental database. It is unrealistic to VACUUM connected database file and this VACUUM command may change the ROWID of entries in tables that don’t have an explicit INTEGER PRIMARY KEY.

The SQLite VACUUM order will come up short if there is a dynamic exchange. As the VACUUM summon modifies the database document starting with no outside help, VACUUM can likewise be utilized to adjust numerous database-particular design parameters. The VACUUM charge is an in-memory databases and there are two types of SQLite Vacuum commands.They are:

shape Syntax

Following is a sample syntax for manual vacuum for the entire database.

$SQLite3 database_name “VACUUM”;

And the above syntax will run by using the following command
SQLite>VACUUM table_name;

shape Syntax

Following is a sample syntax for auto vacuum for the entire database.

SQLite>PRAGMA auto_vacuum = NONE; — 0 means disable auto vacuum
SQLite>PRAGMA auto_vacuum = INCREMENTAL; –1 means enable incremental vacuum
SQLite>PRAGMA auto_vacuum = FULL; –2 means enable full auto vacuum

And the above syntax will run by using the following command

$SQLite3 database_name "PRAGMA auto_vacuum;"

Summary

shape Key Points

  • SQLite Vacuum – It will the primary database by replication.