pgsql: Add a hash opclass for type "tid".

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add a hash opclass for type "tid".
Date: 2018-12-30 20:40:16
Message-ID: E1gdhse-00040N-JP@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add a hash opclass for type "tid".

Up to now we've not worried much about joins where the join key is a
relation's CTID column, reasoning that storing a table's CTIDs in some
other table would be pretty useless. However, there are use-cases for
this sort of query involving self-joins, so that argument doesn't really
hold water.

With larger relations, a merge or hash join is desirable. We had a btree
opclass for type "tid", allowing merge joins on CTID, but no hash opclass
so that hash joins weren't possible. Add the missing infrastructure.

This also potentially enables hash aggregation on "tid", though the
use-cases for that aren't too clear.

Discussion: https://postgr.es/m/1853.1545453106@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0a6ea4001a9dff64e9ba66f68855a59a1bf69bc9

Modified Files
--------------
src/backend/utils/adt/tid.c | 28 +++++++++++++++++++++
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amop.dat | 4 +++
src/include/catalog/pg_amproc.dat | 4 +++
src/include/catalog/pg_opclass.dat | 2 ++
src/include/catalog/pg_operator.dat | 7 +++---
src/include/catalog/pg_opfamily.dat | 2 ++
src/include/catalog/pg_proc.dat | 6 +++++
src/test/regress/expected/tidscan.out | 46 +++++++++++++++++++++++++++++++++++
src/test/regress/sql/tidscan.sql | 14 +++++++++++
10 files changed, 111 insertions(+), 4 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2018-12-30 21:24:55 pgsql: Change "checkpoint starting" message to use "wal"
Previous Message Tom Lane 2018-12-30 18:42:11 pgsql: Teach eval_const_expressions to constant-fold LEAST/GREATEST exp