Speed optimizations for SQLite