It seems that it is not straightforward for reordering columns
in a sqlite3 table
. At least the sqlite manager
in firefox
The order in sqlite3 does matter. Conceptually, it shouldn't, but try this experiment to prove that it does:
CREATE TABLE SomeItems (identifier INTEGER PRIMARY KEY NOT NULL, filename TEXT NOT NULL, path TEXT NOT NULL, filesize INTEGER NOT NULL, thumbnail BLOB, pickedStatus INTEGER NOT NULL, deepScanStatus INTEGER NOT NULL, basicScanStatus INTEGER NOT NULL, frameQuanta INTEGER, tcFlag INTEGER, frameStart INTEGER, creationTime INTEGER);
Populate the table with about 20,000 records where thumbnail is a small jpeg. Then do a couple of queries like this:
time sqlite3 Catalog.db 'select count(*) from SomeItems where filesize = 2;'
time sqlite3 Catalog.db 'select count(*) from SomeItems where basicscanstatus = 2;'
Does not matter how many records are returned, on my machine, the first query takes about 0m0.008s and the second query takes 0m0.942s. Massive difference, and the reason is because of the Blob; filesize is before the Blob and basicscanstatus is after.
We've now moved the Blob into it's own table, and our app is happy.