diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-01 17:38:44 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-06-01 17:38:44 +0000 |
commit | bd2c980b229eb5cf411b1d55bf9b26cca34875d7 (patch) | |
tree | 0677ee408573e19f5c1a2acc6766695aea08143a /src/include/executor/hashjoin.h | |
parent | 1f559b7d3aa411e08d2ad46a4bd7d9213945b103 (diff) |
Buy back some of the cycles spent in more-expensive hash functions by
selecting power-of-2, rather than prime, numbers of buckets in hash joins.
If the hash functions are doing their jobs properly by making all hash bits
equally random, this is good enough, and it saves expensive integer division
and modulus operations.
Diffstat (limited to 'src/include/executor/hashjoin.h')
-rw-r--r-- | src/include/executor/hashjoin.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 19cfb1c473b..8056cd88e92 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/hashjoin.h,v 1.44 2007/01/30 01:33:36 tgl Exp $ + * $PostgreSQL: pgsql/src/include/executor/hashjoin.h,v 1.45 2007/06/01 17:38:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -76,6 +76,8 @@ typedef struct HashJoinTupleData typedef struct HashJoinTableData { int nbuckets; /* # buckets in the in-memory hash table */ + int log2_nbuckets; /* its log2 (nbuckets must be a power of 2) */ + /* buckets[i] is head of list of tuples in i'th in-memory bucket */ struct HashJoinTupleData **buckets; /* buckets array is per-batch storage, as are all the tuples */ |