From: Greg Burd <greg@burd.me>
To: pgsql-hackers@postgresql.org
Cc: zhong950419@gmail.com
Cc: andres@anarazel.de
Cc: greg@burd.me
Cc: michael@paquier.xyz
Cc: pgsql@j-davis.com
Cc: thomas.munro@gmail.com
Cc: exclusion@gmail.com
Cc: amit.kapila16@gmail.com
Cc: hlinnaka@iki.fi
Subject: Re: WAL record CRC calculated incorrectly because of underlying buffer modification
Date: Tue, 27 Oct 2026 13:04:03 +0000
Message-ID: <auCezVSRLgoVNb9G@floki> (raw)
In-Reply-To: <CAGRkXqQwmJ-MDEw9XJB_pQUwgTjQtG72reoQG4qbWoAgmNmPEw@mail.gmail.com>
References: <ats4pi-RM0Uom0T9@floki>
<at7GY97qm-zGyanz@paquier.xyz>
<o564wjvhkq7o7jl7fwbst5dw5rowekcfizmbp4odstjvoh5vve@6jt34ntyeca4>
<at9iIYPKF741ilW_@floki>
<12CB9268-9A1C-4555-96BB-E3EA01B14C0F@anarazel.de>
<CAGRkXqQwmJ-MDEw9XJB_pQUwgTjQtG72reoQG4qbWoAgmNmPEw@mail.gmail.com>
On Mon, 26 Oct 2026 14:08:29 -0400, shihao zhong <zhong950419@gmail.com> wrote:
> Hi Andres and Greg,
>
> > I think they're almost unused and don't offer enough advantage over btree
>
> I largely agree with this. In my experience, B-tree accounts for 95%+ of
> indexes, and all other access methods combined make up only a
> small fraction. But I do see quite a few hash index users.
While I agree that the vast majority of users rightly default to the
BTREE index I don't find that a compelling reason to drop HASH. I see
that as a challenge, maybe HASH isn't used because it is not as well
maintained as BTREE and needs some attention [0]?
> > we should have just ripped them out.
>
> I have mixed feelings on this.
I think this would invite further specialization of code outside nbtree
into shapes that only support nbtree reducing the ability to innovate
with other table and index AMs.
Sure there is GIN, GiST, BRIN, etc. but IMO hash represents a quadrant
of access patterns that we should support, and our code there today
isn't inspiring many to give it a look even for use cases that fit that
pattern well. That's a signal to innovate, not remove code.
We have this issue today with HEAP, because we only have one table AM in
core things are simpler to maintain but it is also easier for heap-isms
to leak outside the table AM boundaries in the name of performance or
other goals.
IMO this is a long-term philosophical question for Postgres; is it
extensible or is it highly opinionated and specialized?
> On one hand, hash is probably the least used
> "general-purpose" index since its use case overlaps directly with B-tree,
> whereas GiST, SP-GiST, and BRIN exist for specialized data types or access
> patterns that B-tree can't handle. On the other hand, in practice I still
> see hash indexes used at least as often as GiST, BRIN, or SP-GiST.
>
> I suspect part of the low adoption is historical baggage from being
> unlogged prior to old version, which gave hash indexes a bad reputation in
> the community, it also miss some features for general OLTP workloads
>
> I feel there is plenty of room for improvement there.
I agree that there is historical baggage, performance, and possibly simple
knowledge gaps that push the adoption toward BTREE.
> > The advantage hash does have, i.e. large key handling, would have better
> > been addressed by adding support to transparently btree indexing a hash
> > of the key + recheck.
>
> That's an interesting point. But I think users can do that today with
> expression index right?
Expression indexes prevent HOT updates, so maybe you could but at what
cost?
> Thanks,
> Shihao
best.
-greg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: greg@burd.me, zhong950419@gmail.com, andres@anarazel.de, michael@paquier.xyz, pgsql@j-davis.com, thomas.munro@gmail.com, exclusion@gmail.com, amit.kapila16@gmail.com, hlinnaka@iki.fi
Subject: Re: WAL record CRC calculated incorrectly because of underlying buffer modification
In-Reply-To: <auCezVSRLgoVNb9G@floki>
References: <ats4pi-RM0Uom0T9@floki> <at7GY97qm-zGyanz@paquier.xyz> <o564wjvhkq7o7jl7fwbst5dw5rowekcfizmbp4odstjvoh5vve@6jt34ntyeca4> <at9iIYPKF741ilW_@floki> <12CB9268-9A1C-4555-96BB-E3EA01B14C0F@anarazel.de> <CAGRkXqQwmJ-MDEw9XJB_pQUwgTjQtG72reoQG4qbWoAgmNmPEw@mail.gmail.com> <auCezVSRLgoVNb9G@floki>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox