What is the Method for Database CleanUp in SQlite? What is the Method for Database CleanUp in SQlite? sqlite sqlite

What is the Method for Database CleanUp in SQlite?


using (SQLiteCommand command = m_connection.CreateCommand()){    command.CommandText = "vacuum;";    command.ExecuteNonQuery();} 

here is the exact answer on how to execute vacuum.


It seems you're looking for the VACUUM statement.


Interesting post script. The Vacuum statement in SQLite copies the entire database to a temp file for rebuilding. If you plan on doing this "On Demand" via user or some process, it can take a considerable amount of disk space and time to complete once your database gets above 100MB, especially if you are looking at several GB. In that case, you are better off using the AUTO_VACUUM=true pragma statement when you create the database, and just deleting records instead of running the VACUUM. So far, this is the only advantage I can find that SQL Server Compact has over SQLite. On demand SHRINK of the Sql Server Compact database is extremely fast compared to SQLite's vacuum.