From 596efd27edce20bba706f50de99a0f15bcc2a567 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 21 Mar 2009 00:04:40 +0000 Subject: Optimize multi-batch hash joins when the outer relation has a nonuniform distribution, by creating a special fast path for the (first few) most common values of the outer relation. Tuples having hashvalues matching the MCVs are effectively forced to be in the first batch, so that we never write them out to the batch temp files. Bryce Cutt and Ramon Lawrence, with some editorialization by me. --- src/include/nodes/plannodes.h | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/include/nodes/plannodes.h') diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 12742b57e5..9caf0895e4 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.108 2009/01/01 17:24:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.109 2009/03/21 00:04:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -460,7 +460,7 @@ typedef struct MergeJoin } MergeJoin; /* ---------------- - * hash join (probe) node + * hash join node * ---------------- */ typedef struct HashJoin @@ -567,11 +567,20 @@ typedef struct Unique /* ---------------- * hash build node + * + * If the executor is supposed to try to apply skew join optimization, then + * skewTable/skewColumn identify the outer relation's join key column, from + * which the relevant MCV statistics can be fetched. Also, its type + * information is provided to save a lookup. * ---------------- */ typedef struct Hash { Plan plan; + Oid skewTable; /* outer join key's table OID, or InvalidOid */ + AttrNumber skewColumn; /* outer join key's column #, or zero */ + Oid skewColType; /* datatype of the outer key column */ + int32 skewColTypmod; /* typmod of the outer key column */ /* all other info is in the parent HashJoin node */ } Hash; -- cgit v1.2.1