summaryrefslogtreecommitdiff
path: root/src/backend/access/hash
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2006-07-02 02:23:23 +0000
committerBruce Momjian <bruce@momjian.us>2006-07-02 02:23:23 +0000
commit277807bd9eba1645d8dfc9252fa29220c4a83751 (patch)
treefb3dca975d8371bd42e9e58d0b841db3fd6c4654 /src/backend/access/hash
parent5d5c1416bf03efcf13cfd3b8f68a0bba199d70af (diff)
downloadpostgresql-277807bd9eba1645d8dfc9252fa29220c4a83751.tar.gz
Add FILLFACTOR to CREATE INDEX.
ITAGAKI Takahiro
Diffstat (limited to 'src/backend/access/hash')
-rw-r--r--src/backend/access/hash/hashpage.c5
-rw-r--r--src/backend/access/hash/hashutil.c15
2 files changed, 17 insertions, 3 deletions
diff --git a/src/backend/access/hash/hashpage.c b/src/backend/access/hash/hashpage.c
index 488a7c5819..bed0b5dbd7 100644
--- a/src/backend/access/hash/hashpage.c
+++ b/src/backend/access/hash/hashpage.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.57 2006/03/31 23:32:05 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashpage.c,v 1.58 2006/07/02 02:23:18 momjian Exp $
*
* NOTES
* Postgres hash pages look like ordinary relation pages. The opaque
@@ -30,6 +30,7 @@
#include "access/genam.h"
#include "access/hash.h"
+#include "catalog/index.h"
#include "miscadmin.h"
#include "storage/lmgr.h"
#include "utils/lsyscache.h"
@@ -231,7 +232,7 @@ _hash_metapinit(Relation rel)
RelationGetDescr(rel)->attrs[0]->atttypmod);
item_width = MAXALIGN(sizeof(IndexTupleData)) + MAXALIGN(data_width) +
sizeof(ItemIdData); /* include the line pointer */
- ffactor = (BLCKSZ * 3 / 4) / item_width;
+ ffactor = BLCKSZ * IndexGetFillFactor(rel) / 100 / item_width;
/* keep to a sane range */
if (ffactor < 10)
ffactor = 10;
diff --git a/src/backend/access/hash/hashutil.c b/src/backend/access/hash/hashutil.c
index 65b8ef948c..fbee1fdc2a 100644
--- a/src/backend/access/hash/hashutil.c
+++ b/src/backend/access/hash/hashutil.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.47 2006/03/05 15:58:21 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/access/hash/hashutil.c,v 1.48 2006/07/02 02:23:18 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -173,3 +173,16 @@ _hash_checkpage(Relation rel, Buffer buf, int flags)
errhint("Please REINDEX it.")));
}
}
+
+Datum
+hashoption(PG_FUNCTION_ARGS)
+{
+#define HASH_MIN_FILLFACTOR 50
+#define HASH_DEFAULT_FILLFACTOR 75
+
+ ArrayType *options = (ArrayType *) PG_GETARG_POINTER(0);
+
+ /* Use index common routine. */
+ PG_RETURN_BYTEA_P(genam_option(options,
+ HASH_MIN_FILLFACTOR, HASH_DEFAULT_FILLFACTOR));
+}