GUC with units, details - Mailing list pgsql-hackers

From Peter Eisentraut
Subject GUC with units, details
Date
Msg-id 200607252356.40710.peter_e@gmx.net
Whole thread Raw
Responses Re: GUC with units, details  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: GUC with units, details  (Michael Glaesemann <grzm@seespotcode.net>)
Re: GUC with units, details  ("Bort, Paul" <pbort@tmwsystems.com>)
List pgsql-hackers
It seems everyone likes the units, so here are some details of the 
implementation I have prepared.

Memory units are kB, MB, GB.  The factor is 1024.

Time units are ms, s, min, h, d.

I intentionally did not support microseconds because that would make the 
coding extremely overflow-risky, and the only candidate commit_delay 
isn't used much.  This can be added once int64 support is required.  
For similar reasons, the unit "byte" is not supported.

The full list of candidates then is:

post_auth_delay                 s
deadlock_timeout                ms
vacuum_cost_delay               ms
autovacuum_vacuum_cost_delay    ms
statement_timeout               ms
authentication_timeout          s
pre_auth_delay                  s
checkpoint_timeout              s
log_min_duration_statement      ms
bgwriter_delay                  ms
log_rotation_age                min
autovacuum_naptime              s
tcp_keepalives_idle             s
tcp_keepalives_interval         s

shared_buffers                  8kB
temp_buffers                    8kB
work_mem                        kB
maintenance_work_mem            kB
log_rotation_size               kB
effective_cache_size            kB (pending switch to int)

Units can be specified with or without space after the number.  In the 
configuration file, writing a space after the number would require 
quoting the entire the value, without a space not.  With SET of course 
you have to quote anyway.

If you don't specify any unit, you get the behavior from before.

Output from SHOW uses the largest unit that fits as long as the number 
is an integer.  (I guess you could change that later to some more 
complex scheme, but I feel that this is better than what we have.)  If 
the value is zero or negative, no unit is used.  (-1 sometimes 
means "off".)

The error messages complaining about range violations and similar things 
should perhaps also be changed to use units.

I'm a bit afraid of removing all references to the true internal units 
of these parameters, because before long someone will see a message "I 
don't like value 123" and they won't know what unit it is.  We'll have 
to deal with those as we go along I guess.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


pgsql-hackers by date:

Previous
From: Ron Mayer
Date:
Subject: Re: On-disk bitmap index patch
Next
From: Tom Lane
Date:
Subject: Re: GUC with units, details