Secondary indexes: where does the row live?
Secondary indexes: where does the row live?
Clustered index
row stored in the leaf
e.g. InnoDB primary key
reads: one lookup
move = costly rewrite
Heap file + index
index holds only pointers
rows unordered in heap
e.g. PostgreSQL
update may relocate
Covering index
columns copied inside
answer without the heap
more space, more writes
no heap visit
Layout decides: read speed vs write cost