When the database format is 2 or higher (explicitly via "PRAGMA 
legacy_file_format = false;" or implicitly via "ALTER TABLE ... ADD COLUMN 
..."), sqlite doesn't currently take advantage of the fact that NULL columns at 
the end don't have to be stored.

For example:
> PRAGMA legacy_file_format = false;
> CREATE TABLE test (n1,n2,n3,...,n500);
> INSERT INTO test(n1) VALUES('first');
> INSERT INTO test(n1) VALUES('second');
...
> INSERT INTO test(n1) VALUES('twentieth');

Takes a lot more space than:
> CREATE TABLE test (n1);
> INSERT INTO test(n1) VALUES('first');
> INSERT INTO test(n1) VALUES('second');
...
> INSERT INTO test(n1) VALUES('twentieth');
> ALTER TABLE test ADD COLUMN n2;
> ALTER TABLE test ADD COLUMN n3;
...
> ALTER TABLE test ADD COLUMN n500;

Even though the resulting databases are the same, and even if VACUUM is 
performed.
                                          
_________________________________________________________________
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to