On 4/30/15, James K. Lowden <jklowden at schemamania.org> wrote: > > SQLite keeps its rows in pages and reads whole pages. Within a page it > references rows and columns by offset. Every location within a page is > accessed in constant time. So column order doesn't matter because > page-offset doesn't matter. >
It's more complicated than that. (1) A single row might span multiple pages. SQLite will only read pages from disk for the prefix of the row it actually needs. (2) Even if the row is all on one page, SQLite has to compute sizes of all prior columns and add those sizes together in order to find the offset to a particular column in that row. The fewer prior columns there are, the less work is involved for this step. -- D. Richard Hipp drh at sqlite.org