Introduction to PostgreSQL Indexes
dlt.github.io
Introduction to PostgreSQL Indexes
1–10 of 19 posts
Re: Introduction to PostgreSQL Indexes
#2Re: Introduction to PostgreSQL Indexes
#3For general B Tree index resources this has been my got to site for years https://use-the-index-luke.com/
Re: Introduction to PostgreSQL Indexes
#4Re: Introduction to PostgreSQL Indexes
#5I 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.
Re: Introduction to PostgreSQL Indexes
#6Re: Introduction to PostgreSQL Indexes
#7Re: Introduction to PostgreSQL Indexes
#8It would be nice to see out-of-the-box support in PostgreSQL for what's known as incremental view maintenance. It's very much an index in that it gets updated automatically when the underlying data changes, but it supports that for arbitrary views - not just special-cased like ordinary database indexes.
From memory, handful of projects just dedicated to this dimension of databases: Noria, Materialize, Apache Flink, GCP's Continuous Queries, Apache Spark Streaming Tables, Delta Tables, ClickHouse streaming tables, TimescaleDB, ksqlDB, StreamSQL; and dozens more probably. IIRC, since this is about postgres, there is recently created extension trying to deal with this: pg_ivm
Re: Introduction to PostgreSQL Indexes
#9The 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…
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.
Re: Introduction to PostgreSQL Indexes
#10The 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…