On Mon, 2026-10-26 at 11:15 -0400, Andres Freund wrote:
> 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.
In theory we could generalize this. We can take any predicate x=a,
create a new implied predicate f(x)=f(a), and then use a functional
index on f(x). (Assuming f() satisfies the right properties and
equality means the very same value.)
The planner wouldn't need any extra logic to recheck, because the x=a
predicate is still there. If there's no index on (x) but there's an
index on (f(x)), then we can see if f is a member of a hash opclass, or
if it's IMMUTABLE & LEAKPROOF, and I think that's enough.
Regards,
Jeff Davis