summaryrefslogtreecommitdiff
path: root/src/backend/access/gist/gistutil.c
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-09-08 17:51:23 +0300
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2011-09-08 17:51:23 +0300
commit5edb24a8983e4a103e26153853d91141f818227c (patch)
tree9e3102de6e2149b0d3678b403c91955e97f3bdc8 /src/backend/access/gist/gistutil.c
parent09b68c70af855a0a69cede14da70968ddd97ba05 (diff)
downloadpostgresql-5edb24a8983e4a103e26153853d91141f818227c.tar.gz
Buffering GiST index build algorithm.
When building a GiST index that doesn't fit in cache, buffers are attached to some internal nodes in the index. This speeds up the build by avoiding random I/O that would otherwise be needed to traverse all the way down the tree to the find right leaf page for tuple. Alexander Korotkov
Diffstat (limited to 'src/backend/access/gist/gistutil.c')
-rw-r--r--src/backend/access/gist/gistutil.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/src/backend/access/gist/gistutil.c b/src/backend/access/gist/gistutil.c
index 448d8bce05..d91025dbe7 100644
--- a/src/backend/access/gist/gistutil.c
+++ b/src/backend/access/gist/gistutil.c
@@ -667,13 +667,30 @@ gistoptions(PG_FUNCTION_ARGS)
{
Datum reloptions = PG_GETARG_DATUM(0);
bool validate = PG_GETARG_BOOL(1);
- bytea *result;
+ relopt_value *options;
+ GiSTOptions *rdopts;
+ int numoptions;
+ static const relopt_parse_elt tab[] = {
+ {"fillfactor", RELOPT_TYPE_INT, offsetof(GiSTOptions, fillfactor)},
+ {"buffering", RELOPT_TYPE_STRING, offsetof(GiSTOptions, bufferingModeOffset)}
+ };
- result = default_reloptions(reloptions, validate, RELOPT_KIND_GIST);
+ options = parseRelOptions(reloptions, validate, RELOPT_KIND_GIST,
+ &numoptions);
+
+ /* if none set, we're done */
+ if (numoptions == 0)
+ PG_RETURN_NULL();
+
+ rdopts = allocateReloptStruct(sizeof(GiSTOptions), options, numoptions);
+
+ fillRelOptions((void *) rdopts, sizeof(GiSTOptions), options, numoptions,
+ validate, tab, lengthof(tab));
+
+ pfree(options);
+
+ PG_RETURN_BYTEA_P(rdopts);
- if (result)
- PG_RETURN_BYTEA_P(result);
- PG_RETURN_NULL();
}
/*