From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Provide hashing support for arrays. |
Date: | 2010-10-31 01:56:53 |
Message-ID: | E1PCNAD-0004gz-98@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Provide hashing support for arrays.
The core of this patch is hash_array() and associated typcache
infrastructure, which works just about exactly like the existing support
for array comparison.
In addition I did some work to ensure that the planner won't think that an
array type is hashable unless its element type is hashable, and similarly
for sorting. This includes adding a datatype parameter to op_hashjoinable
and op_mergejoinable, and adding an explicit "hashable" flag to
SortGroupClause. The lack of a cross-check on the element type was a
pre-existing bug in mergejoin support --- but it didn't matter so much
before, because if you couldn't sort the element type there wasn't any good
alternative to failing anyhow. Now that we have the alternative of hashing
the array type, there are cases where we can avoid a failure by being picky
at the planner stage, so it's time to be picky.
The issue of exactly how to combine the per-element hash values to produce
an array hash is still open for discussion, but the rest of this is pretty
solid, so I'll commit it as-is.
Branch
------
master
Details
-------
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=186cbbda8f8dc5e42f68fc7892f206a76d56a20f
Modified Files
--------------
src/backend/commands/analyze.c | 3 +-
src/backend/nodes/copyfuncs.c | 1 +
src/backend/nodes/equalfuncs.c | 1 +
src/backend/nodes/outfuncs.c | 1 +
src/backend/nodes/readfuncs.c | 1 +
src/backend/optimizer/path/equivclass.c | 4 +-
src/backend/optimizer/plan/createplan.c | 1 +
src/backend/optimizer/plan/initsplan.c | 9 ++-
src/backend/optimizer/plan/planagg.c | 1 +
src/backend/optimizer/plan/subselect.c | 39 ++++++++---
src/backend/optimizer/util/pathnode.c | 7 ++-
src/backend/optimizer/util/tlist.c | 8 +--
src/backend/parser/analyze.c | 5 +-
src/backend/parser/parse_clause.c | 23 +++++--
src/backend/parser/parse_oper.c | 51 ++++++++-------
src/backend/utils/adt/arrayfuncs.c | 111 +++++++++++++++++++++++++++++++
src/backend/utils/cache/lsyscache.c | 75 +++++++++++++++++----
src/backend/utils/cache/typcache.c | 71 +++++++++++++++++---
src/include/catalog/catversion.h | 2 +-
src/include/catalog/pg_amop.h | 2 +
src/include/catalog/pg_amproc.h | 1 +
src/include/catalog/pg_opclass.h | 1 +
src/include/catalog/pg_operator.h | 2 +-
src/include/catalog/pg_opfamily.h | 1 +
src/include/catalog/pg_proc.h | 3 +
src/include/nodes/parsenodes.h | 8 ++
src/include/parser/parse_oper.h | 3 +-
src/include/utils/array.h | 1 +
src/include/utils/lsyscache.h | 4 +-
src/include/utils/typcache.h | 23 ++++---
30 files changed, 375 insertions(+), 88 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-10-31 15:43:51 | pgsql: Revert removal of trigger flag from plperl function hash key. |
Previous Message | Peter Eisentraut | 2010-10-30 20:38:24 | pgsql: Change version number in release notes to 9.1alpha2 |