pgsql: Add a hash opclass for type "tid". - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Add a hash opclass for type "tid".
Date
Msg-id E1gdhse-00040N-JP@gemulon.postgresql.org
Whole thread Raw
List 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(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Teach eval_const_expressions to constant-fold LEAST/GREATESTexp
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Change "checkpoint starting" message to use "wal"