- Published on
Investigation · Part 3 of 10 · Inside a database index
What an Index Costs on Every Insert
I inserted one million rows into SQLite with 0, 1, 3 and 6 indexes. The table alone took 0.8 s and six indexes took 8.5 s, but the biggest cost was not the number of indexes: one index on a random column made SQLite pass 4 GB to write() for a 106 MB file.