GUC with units, details

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: GUC with units, details
Date: 2006-07-25 21:56:40
Message-ID: 200607252356.40710.peter_e@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-07-25 22:04:26 Re: GUC with units, details
Previous Message Ron Mayer 2006-07-25 21:53:29 Re: On-disk bitmap index patch