2

I run these commands on an sqlite database

sqlite3 data.db .dump > data.txt
cat data.txt | sqlite3 newdata.db

The file size of newdata.db is 10% larger than data.db (for a 100MB database with 400k entries). Why is that so?

data.db was created with sequential inserts & no deletes. Nothing complicated. I had set the following 2 PRAGMA while creating the tables but the dump file doesn't show them (probably they persist across connection only).

PRAGMA page_size = 4096;
PRAGMA cache_size = 72500;

Sample contents of data.txt.

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE urltable (url TEXT NOT NULL, PRIMARY KEY url);
INSERT INTO "urltable" VALUES('http://www.example.com/page1.html');
...
COMMIT;

1 Answer 1

2

I'll leave this here for reference... adding these back to data.txt before creating the new db did the trick.

PRAGMA page_size = 4096;
PRAGMA cache_size = 72500;
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.