Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLite Filesize is still not change after drop table [duplicate]

Tags:

sql

php

sqlite

  1. I have a SQLite Database 4MB.
  2. I used command drop table name; and I dropped it. I checked in SQlite Manager that no more table name.
  3. However, I checked the filesize, it is still 4MB, the same.
  4. I use NotePade, open the Database I see the old contents which I have inserted are still there.

Did I do anything wrong on drop table command? or SQLite keeps old data and filesize will the same?

Thanks your help.

like image 311
Ken Le Avatar asked Apr 27 '13 10:04

Ken Le


People also ask

How do I reduce the size of my SQLite database?

VACUUM will reconstruct the database from scratch and keep the database minimal in size. Thus, it is a recommended good practice to execute VACUUM periodically to reduce the SQLite database file size.

How do you VACUUM SQLite?

The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. When overwriting the original, a rollback journal or write-ahead log WAL file is used just as it would be for any other database transaction.

How to quit SQLite in terminal?

Terminate the sqlite3 program by typing your system End-Of-File character (usually a Control-D). Use the interrupt character (usually a Control-C) to stop a long-running SQL statement.

How to run SQLite in cmd?

Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.


1 Answers

You need to read https://stackoverflow.com/a/2143808/2198378

Although file size was same, data will be overridden.

To avoid it, refer VACUUM and auto_vacuum.

like image 196
jeyraof Avatar answered Oct 19 '22 23:10

jeyraof