zlacker

Introduction to PostgreSQL Indexes

submitted by dlt+(OP) on 2026-01-25 08:07:03 | 328 points 16 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
2. turboc+az[view] [source] 2026-01-25 13:42:33
>>dlt+(OP)
This looks really awesome for Postgres

For general B Tree index resources this has been my got to site for years https://use-the-index-luke.com/

3. cdiama+BA[view] [source] 2026-01-25 13:54:45
>>dlt+(OP)
Linking to the postgresql docs since they are very well written and surprisingly enjoyable to read.

https://www.postgresql.org/docs/current/indexes-intro.html

4. jihadj+aB[view] [source] 2026-01-25 13:59:32
>>dlt+(OP)
The section on multi-column indexes mirrors how I was taught and how I’ve generally handled such indexes in the past. But is it still true for more recent PG versions? I had an index and query similar to the third example, and IIRC PG was able to use an index, though I believe it was a bitmap index scan.

I am also unsure of the specific perf tradeoffs between index scan types in that case, but when I saw that happen in the EXPLAIN plan it was enough for me to call into question what had been hardcoded wisdom in my mind for quite some time.

Further essential reading is the classic Use The Index, Luke [0] site, and the book is a great buy for the whole team.

0: https://use-the-index-luke.com/

6. brudge+oJ[view] [source] 2026-01-25 15:06:22
>>dlt+(OP)
Related, Use the Index Luke

https://use-the-index-luke.com/

◧◩
8. peterg+JP[view] [source] [discussion] 2026-01-25 15:42:12
>>jihadj+aB
> The section on multi-column indexes mirrors how I was taught and how I’ve generally handled such indexes in the past. But is it still true for more recent PG versions?

No, it isn't. PostgreSQL 18 added support for index skip scan:

https://youtu.be/RTXeA5svapg?si=_6q3mj1sJL8oLEWC&t=1366

It's actually possible to use a multicolumn index with a query that only has operators on its lower-order columns in earlier versions. But that requires a full index scan, which is usually very inefficient.

[go to top]