Bimal Poudel
Bimal Poudel

Reputation: 1234

Huge differences in SQLite data files sizes

Let us consider a tiny table in SQLite 3.

create table numbers(id int);

If you execute this with command line sqlite3, it ends the data file size of 2KB. But another tool (ie. SQLite Manager in Firefox's addon) ends with 64KB data file size.

Here is the command line version:

c:\>sqlite3 test.sqlite
sqlite> create table numbers(id int);
sqlite> .exit
c:\>

Both the data files are in SQLite 3 format. In my case, both have 3.8.11.1 version. But what makes this big change in file size?

Are these data files compatible to each other for a drop-in replacements?

Upvotes: 0

Views: 400

Answers (1)

CL.
CL.

Reputation: 180060

Both the database header (which contains the sqlite_master table) and the numbers table occupy one page in the database file.

The default page size is 1 KB, but SQLite Manager apparently sets it to 32 KB. (When databases are so large that performance matters, larger pages are more efficient.)

The page size is a transparent implementation detail and does not affect compatibility.

Upvotes: 1

Related Questions