Sobes.tech
Junior — Middle

What indexing structure is used by default in the PostgreSQL database?

sobes.tech AI

Answer from AI

By default, PostgreSQL uses a B-tree structure for indexing (a balanced tree).

B-tree is well-suited for fast searches, sorting, and range queries. It efficiently handles comparison operations such as =, <, <=, >, >=.

Example of creating a default index:

CREATE INDEX idx_name ON table_name(column_name);

This index will be a B-tree unless another type is explicitly specified.