Sobes.tech
Junior — Middle

Which built-in data structure indexes tables by default in PostgreSQL?

sobes.tech AI

Answer from AI

In PostgreSQL, the default data structure used for indexing tables is the B-tree (balanced tree).

A B-tree index provides efficient search, insertion, and deletion of data, supports comparison and sorting operations, making it versatile for most use cases. This type of index is created if no other type is explicitly specified when creating the index.

Example of creating a default index:

CREATE INDEX idx_name ON table_name (column_name);

This index will be a B-tree.