Re: [patch] GUC source file and line number]

From: Greg Smith <gsmith(at)gregsmith(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [patch] GUC source file and line number]
Date: 2008-09-04 00:42:49
Message-ID: Pine.GSO.4.64.0809032035410.17137@westnet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Before I respond to Tom's comments, let me step back a second and add the
intro the deadline didn't leave me time for. There are two specific
things the bit I added to this GUC patch is aimed at:

1) Somebody has a postgresql.conf from a random source (saw it on the
Internet and pasted dubious stuff in/previous person working on the
server/etc.) and wants to know the default value they'd get if they just
commented a specific line or lines out.

2) A GUC tuning tool author wants to provide a UI for modifying a GUC
parameter that shows the default as input to the person deciding what to
set a parameter to. The interface I've always wanted to make available
would be...wait a minute, I can provide a working example now. Picture
this:

name | Recommended | Current | Min | Default | Max
-------------+-------------+---------+-------+---------+---------
wal_buffers | 1024kB | 64kB | 32 kB | 64 kB | 2048 MB

With your cursor lighting up either the "Recommended" or "Current" field,
depending on whether you're a default approve or deny kind of tool
designer. Pretty simple interface to decide what to do, right? I find
that much less useful without the default value being included, but right
now someone who is writing a tuning tool has to maintain their own
database with that information if they want to do that. I will actually
do that for earlier versions the minute I know what the 8.4 solution that
makes the problem go away looks like.

The above is the output from:

select name,
'1024kB' as "Recommended",
current_setting(name) as "Current",
case when unit='8kB' then pg_size_pretty(min_val::int8*8192) else
min_val end as "Min",
case when unit='8kB' then pg_size_pretty(default_val::int8*8192) else
default_val end as "Default",
case when unit='8kB' then pg_size_pretty(max_val::int8) else max_val end
as "Max"
from pg_settings where name='wal_buffers';

on my system with the patch installed.

That's what I wanted but was unable to get until now. Combine that with
being able to figure out what source file and line the setting was
actually taken from, and the top 3 obstacles to writing a simple and easy
to use read/modify/write tuning tool are all cleared.

--
* Greg Smith gsmith(at)gregsmith(dot)com http://www.gregsmith.com Baltimore, MD

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Smith 2008-09-04 00:49:25 Re: [patch] GUC source file and line number]
Previous Message Stephen Frost 2008-09-04 00:41:41 Re: Extending grant insert on tables to sequences