Re: Building infrastructure for B-Tree deduplication that recognizes when opclass equality is also equivalence
Peter Geoghegan <pg@bowt.ie>
From: Peter Geoghegan <pg@bowt.ie>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Anastasia Lubennikova <a.lubennikova@postgrespro.ru>,
Antonin Houska <ah@cybertec.at>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-12-20T00:12:22Z
Lists: pgsql-hackers
On Thu, Dec 19, 2019 at 12:05 PM Robert Haas <robertmhaas@gmail.com> wrote: > My impression is that this is more of an implementation restriction > than a design goal. I don't really remember the details, but it seems > to me that there were locking and/or cache invalidation problems with > making ALTER OPERATOR CLASS do more substantive things -- and that it > was because of those problems, not a lack of desire, that we didn't > support it. I agree with you. My point was only that this is something that the operator class author is really expected to get right the first time around -- just like the behavior of B-Tree support function 1. We're really only concerned about the upgrade path for external types that could see a benefit from the optimization planned for nbtree (and possibly other such optimization). Providing a non-disruptive way to get that benefit after a pg_upgrade only seems like a nice-to-have to me, because it's not as if anything will stop working as well as it once did. Also, there aren't that many external types that will be made more useful by being able to use optimizations like deduplication; in practice almost all B-Tree indexes only use a small handful of operator classes that are shipped in core Postgres. Once you're using common types like text and integer, a pg_upgrade'd database is only a REINDEX away from being able to use deduplication (though I am not even sure if even that will be necessary in the final patch; I hope to be able to avoid even that inconvenience with indexes using core operator classes). If the underlying behavior of an operator class actually changes, then that's a disaster for all the usual reasons. It doesn't make that much sense to reverse an earlier decision to make an operator class BITWISE. Better to drop everything, and recreate everything, since your indexes should be considered corrupt anyway. (Also, I don't think that it's that hard to get it right, so this will probably never happen.) -- Peter Geoghegan
Commits
-
Add equalimage B-Tree support functions.
- 612a1ab76724 13.0 landed
-
Make _bt_keep_natts_fast() use datum_image_eq().
- 1f55ebae2722 13.0 landed
-
Teach datum_image_eq() about cstring datums.
- 8c951687f58a 13.0 landed
-
Fix optimization of foreign-key on update actions
- 1ffa59a85cb4 12.0 cited
-
Support all SQL:2011 options for window frame clauses.
- 0a459cec96d3 11.0 cited
-
Create a "sort support" interface API for faster sorting.
- c6e3ac11b60a 9.2.0 cited