How PostgreSQL Automatically Reduces B+Tree Index Height After Deletions
B+tree indexes, used widely in databases, grow in height as data is inserted and pages split, with each additional level increasing lookup cost by one page read. In traditional implementations like Oracle Database, the index height never decreases after deletions unless the index is fully rebuilt. PostgreSQL, however, is capable of reducing the effective height of a B+tree index automatically when data is deleted, without requiring a manual rebuild. A test using a five-million-row table with UUID primary keys demonstrated a tree height of three levels, requiring three page reads per key lookup. This behavior distinguishes PostgreSQL from other database engines and has practical implications for query performance after large-scale deletions.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in