3 ms·
> The tables themselves aren't btree indexes, there isn't any sort of "clustered" index on all columns. What do you think a btree index is exactly? Especially
by masklinn 4y ago
> The tables themselves aren't btree indexes, there isn't any sort of "clustered" index on all columns.
What do you think a btree index is exactly? Especially a covering index?
> It's just that the tables rows are entries in a btree, indexed by rowid.
That’s what a clustered index (/ table) is. It’s when the table's storage is organised by the chosen clustering key. In SQLite, all tables are clustered, and the clustering key is the ROWID, or the primary key for tables WITHOUT ROWID. You can think of it as the table being its own covering index (keyed on the clustering key, and INCLUDE-ing all other columns).
By opposition a database which uses heap tables (like postgres) needs a separate index for its PK (it also needs one to enforce unicity so that's two birds one stone).
- winrid 4y agoI see. When I think of a covering index, I think of a covered query, where all query data can be fetched from the index itself. Doesn't the rowid btree just point to an offset on disk where the actual row is? Or is the row itself in the index?