DELAPARRA
Index
Color
NL
Category: SQL

B-tree index

Explained by Updated

What is B-tree index?

B-tree index: The default, general-purpose index. Balanced tree that supports equality and range queries and ORDER BY. A B-tree index is the default index type in most relational databases. It keeps values sorted in a balanced tree, so the database can find a row in a few steps instead of reading the whole table.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about B-tree index

How is B-tree index used in practice?

It supports exact matches, ranges and sorting. A query like WHERE created_at > '2026-01-01' ORDER BY created_at can use a B-tree index on created_at for both the filter and the order.

What should you keep in mind with B-tree index?

The column order in a composite index matters. An index on (customer_id, created_at) helps queries that filter on customer_id, but not queries that only filter on created_at. Every index also slows down writes a little and uses disk space. Add indexes for the queries you actually run, and use EXPLAIN to check that the database uses them.

What does an example of B-tree index look like?

CREATE INDEX idx_orders_created ON orders (created_at);

At a glance

CategorySQL
Explained by
Updated

More SQL terms

All terms starting with B

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.