SQLite Forum

Best order to vaccum, analyze, create indexes, etc.. ?
Login
In terms of performance, you could take out all UNIQUE and PRIMARY KEY
constraints from the table definitions and transform those into
CREATE UNIQUE INDEXs that you run at the same time as your other
CREATE INDEXes (as you suggest).  And you could run the CREATE INDEXes
after VACUUM, but do so before ANALYZE (again, as you already suggest).
Other than those tweaks, I think what you are doing is optimal.