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: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, Anastasia Lubennikova <a.lubennikova@postgrespro.ru>
Date: 2019-08-25T21:18:12Z
Lists: pgsql-hackers
On Sun, Aug 25, 2019 at 1:56 PM Tom Lane <tgl@sss.pgh.pa.us> wrote: > Hmm, so that would exclude the optimization for numeric, float4/float8, > and nondeterministic text collations. Anything else? Any pseudo-type whose output function could possibly be dependent on the output function of another type (in case it happens to be one of the types that definitely aren't safe). Maybe we could make fine distinctions about pseudo-type safety in certain contexts, but that doesn't matter to the deduplication patch. > I agree that teaching opclasses to say whether this is okay is a > reasonable approach. Great. > > Consumers of this new infrastructure probably won't be limited to the > > deduplication feature; > > Indeed, we run up against this sort of thing all the time in, eg, planner > optimizations. I think some sort of "equality is precise" indicator > would be really useful for a lot of things. The case that I happened to think of was "collation strength reduction". In other words, an optimization that has the planner use a merge equijoin whose joinqual involves two text columns using the "C" collation, even though the "C" collation isn't otherwise usable. Perhaps there are far more compelling planner optimization that I haven't considered, though. This idea probably has problems with interesting sort orders that aren't actually that interesting. -- 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