1

What I have seen so far in the documentation of Postgres that when we want to index some column, it will by default use B tree as the data structure of indexing but B+ tree is much faster than B tree so why default indexing is on B tree and not on B+ tree.

For Reference(how B+ tree is better): https://www.tutorialcup.com/dbms/b-tree.htm

So my question is: why they are not using B+ tree for indexing by default.

a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843
Nikunj Aggarwal
  • 276
  • 4
  • 14

1 Answers1

1

I'm not an expert on the subject, but there seems to be nothing to gain using B+ trees instead of regular B trees for indexing in PostgreSQL.

From Wikipedia:

Normal ("btree" type) indexes in Postgres are not B+ trees. The distinction between B+ trees and B-trees is kind of nonsense for database indexes in the first place -- all the columns in the index itself are the lookup key, and they're the same on the leaf level as any other level. The record itself is generally stored in a separate structure -- in the case of Postgres, it's the table heap.

Rens Verhage
  • 5,223
  • 4
  • 31
  • 50