From 5edb24a8983e4a103e26153853d91141f818227c Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Thu, 8 Sep 2011 17:51:23 +0300 Subject: 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 --- src/backend/access/gist/gistutil.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/backend/access/gist/gistutil.c') 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(); } /* -- cgit v1.2.1