pg_conf idea (was Re: Postgres performance comments from a MySQL user)

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Matthew Nuzum" <cobalt(at)bearfruit(dot)org>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>, <pgsql-hackers(at)postgresql(dot)org>
Subject: pg_conf idea (was Re: Postgres performance comments from a MySQL user)
Date: 2003-06-12 17:06:44
Message-ID: 200306121006.44296.scrawford@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

On Wednesday 11 June 2003 2:37 pm, Matthew Nuzum wrote:
> The problem with this is that in troubleshooting there's no frame of
> reference. Having a stock config file, or stock config file options allows
> a person to write to the list and say, "hey, I'm using medium.conf and I
> have x ram..."
>
> The alternative is, "hey, see my attached .conf file..." which takes a lot
> more effort.

The postfix mail transport agent has a command "postconf" which allows you to
read or change entries in the config file. Like postgresql, postfix uses
certain defaults when there is no corresponding configuration entry.

Running "postconf" displays all settings while "postconf -n" command displays
only non-default configuration settings. The output of "postconf -n" is
generally one of the first things requested when someone asks a question.
(Being a mail server, most questions are ultimately configuration related -
postgresql questions are more varied.)

You can also change a setting with "postconf parameter=value".

Perhaps a similar command would be useful for postgresql. Just please don't
call it "postconf". :)

Note: this would also provide a nice core interface for all sorts of purposes
like updating configuration entries based on automatic analysis of database
size/memory/cpu or based on asking the admin questions about the database use
profile and then using the command (say pg_conf) to update specified options,
save current settings and restore everything to default for
testing/troubleshooting then restore the original settings, etc.

Looking through the useful options for postconf, I think a useful base set of
features for pg_conf would be

pg_conf -D datadir [-n] [-h] [-d] [parameter...]

Output (unless -h is specified) would look like:
foo = 8192
bar = 0
...

where:
-n = only output values that are different than the default

-h = show the value only (useful for extracting values into scripts, eg,
pg_conf -h foo would return "8192" instead of "foo = 8192". Note: I just
borrowed -h from postconf - choose any logical letter.)

-d = show the default value for the parameter

The optional parameter list limits the display to that/those parameter(s).

I haven't checked the source code, yet, but I suspect that most of the
necessary code for such a command is already in whatever module reads
postgresql.conf.

Thoughts?

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Weiping He 2003-06-12 17:14:21 Re: Cast: timestamp to integer
Previous Message David Wheeler 2003-06-12 17:05:09 ANNOUNCE: Bricolage 1.6.1

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Clift 2003-06-12 17:29:37 Re: [HACKERS] SAP and MySQL ... [and Benchmark]
Previous Message Dennis Gearon 2003-06-12 16:58:49 Re: [HACKERS] SAP and MySQL ... [and Benchmark]