Skip site navigation (1) Skip section navigation (2)

generic reloptions improvement

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: generic reloptions improvement
Date: 2008-12-19 21:55:19
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

Here's a patch for improving the general reloptions mechanism.  What
this patch does is add a table-based option parser.  This allows adding
new options very easily, and stops the business of having to pass the
minimum and default fillfactor each time you want the reloptions
processed.  (This approach would not scale very well; each new reloption
requires more parameters to default_reloptions, and at the same time we
are forcing external AMs to support fillfactor, which they may very well
do not.  For example GIN was already passing useless values

I kept StdRdOptions as a fixed struct, which fixes the previous complain
about speed.  The new code parses the array and stores the values into
the fixed struct.  The only new thing in this area is that
default_reloptions has to walk the returned array of relopt_gen to store
the values in the struct.  So in order to add a new option, it is
necessary to patch both the options table (intRelOpts, etc) *and*
default_reloptions.  This is a bit ugly but it's the only way I found to
keep both generality and speed.

Right now, external AMs cannot do anything much apart from fillfactor,
but it is very simple to add a routine to register a new "reloption
kind" and another to register options in the table.  That and a new
*_reloptions routine (which needs to be registered in pg_am) would allow
an AM to create whatever options it needs.

Note that the only types supported are int, bool, real.  We don't
support strings.  I don't see this as a problem, but shout if you
disagree.  (In the current patch, the bool and real lists are empty.
The autovacuum patch adds items to both.)

The patch to add the autovacuum options on top of this is very light on
reloptions.c but heavy on lots of other places, which is why I'm
submitting this separately.

Alvaro Herrera                      
The PostgreSQL Company - Command Prompt, Inc.

Attachment: reloptions-3.patch
Description: text/x-diff (23.2 KB)


pgsql-hackers by date

Next:From: Tom LaneDate: 2008-12-19 22:25:48
Subject: Re: DTrace probes patch
Previous:From: Robert LorDate: 2008-12-19 21:43:01
Subject: Re: DTrace probes patch

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group