aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/hashjoin.h
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
committerMarc G. Fournier <scrappy@hub.org>1996-07-09 06:22:35 +0000
commitd31084e9d1118b25fd16580d9d8c2924b5740dff (patch)
tree3179e66307d54df9c7b966543550e601eb55e668 /src/backend/executor/hashjoin.h
downloadpostgresql-PG95-1_01.tar.gz
postgresql-PG95-1_01.zip
Postgres95 1.01 Distribution - Virgin SourcesPG95-1_01
Diffstat (limited to 'src/backend/executor/hashjoin.h')
-rw-r--r--src/backend/executor/hashjoin.h82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/backend/executor/hashjoin.h b/src/backend/executor/hashjoin.h
new file mode 100644
index 00000000000..e7ae086fe16
--- /dev/null
+++ b/src/backend/executor/hashjoin.h
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+ *
+ * hashjoin.h--
+ * internal structures for hash table and buckets
+ *
+ *
+ * Copyright (c) 1994, Regents of the University of California
+ *
+ * $Id: hashjoin.h,v 1.1.1.1 1996/07/09 06:21:25 scrappy Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+#ifndef HASHJOIN_H
+#define HASHJOIN_H
+
+#include "access/htup.h"
+#include "storage/ipc.h"
+
+/* -----------------
+ * have to use relative address as pointers in the hashtable
+ * because the hashtable may reallocate in difference processes
+ * -----------------
+ */
+typedef int RelativeAddr;
+
+/* ------------------
+ * the relative addresses are always relative to the head of the
+ * hashtable, the following macro converts them to absolute address.
+ * ------------------
+ */
+#define ABSADDR(X) ((X) < 0 ? NULL: (char*)hashtable + X)
+#define RELADDR(X) (RelativeAddr)((char*)(X) - (char*)hashtable)
+
+typedef char **charPP;
+typedef int *intP;
+
+/* ----------------------------------------------------------------
+ * hash-join hash table structures
+ * ----------------------------------------------------------------
+ */
+typedef struct HashTableData {
+ int nbuckets;
+ int totalbuckets;
+ int bucketsize;
+ IpcMemoryId shmid;
+ RelativeAddr top; /* char* */
+ RelativeAddr bottom; /* char* */
+ RelativeAddr overflownext; /* char* */
+ RelativeAddr batch; /* char* */
+ RelativeAddr readbuf; /* char* */
+ int nbatch;
+ RelativeAddr outerbatchNames; /* RelativeAddr* */
+ RelativeAddr outerbatchPos; /* RelativeAddr* */
+ RelativeAddr innerbatchNames; /* RelativeAddr* */
+ RelativeAddr innerbatchPos; /* RelativeAddr* */
+ RelativeAddr innerbatchSizes; /* int* */
+ int curbatch;
+ int nprocess;
+ int pcount;
+} HashTableData; /* real hash table follows here */
+
+typedef HashTableData *HashJoinTable;
+
+typedef struct OverflowTupleData {
+ RelativeAddr tuple; /* HeapTuple */
+ RelativeAddr next; /* struct OverflowTupleData * */
+} OverflowTupleData; /* real tuple follows here */
+
+typedef OverflowTupleData *OverflowTuple;
+
+typedef struct HashBucketData {
+ RelativeAddr top; /* HeapTuple */
+ RelativeAddr bottom; /* HeapTuple */
+ RelativeAddr firstotuple; /* OverflowTuple */
+ RelativeAddr lastotuple; /* OverflowTuple */
+} HashBucketData; /* real bucket follows here */
+
+typedef HashBucketData *HashBucket;
+
+#define HASH_PERMISSION 0700
+
+#endif /* HASHJOIN_H */