Re: Fractions in GUC variables

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: John Gorman <johngorman2(at)gmail(dot)com>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fractions in GUC variables
Date: 2014-12-15 13:56:19
Message-ID: 548EE883.8020303@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 12/07/2014 09:48 PM, John Gorman wrote:
> This patch implements the first wiki/Todo Configuration Files item
> "Consider normalizing fractions in postgresql.conf, perhaps using '%'".
>
> The "Fractions in GUC variables" discussion is here.
>
> http://www.postgresql.org/message-id/467132CF.9020501@enterprisedb.com

Ah, flash from the past :-). Thanks for looking into this.

The bgwriter_lru_percent and bgwriter_all_percent settings are gone now,
so the original reason to do this is gone. We consistently use fractions
in the GUCs now.

> This patch implements expressing GUC variables as percents in
> postgresql.conf.
>
> autovacuum_vacuum_scale_factor = 20% # percent of table size before vacuum
> autovacuum_analyze_scale_factor = 10% # percent of table size before
> analyze
>
> As you can see the postgresql.conf file and the documentation read more
> naturally. I added a regression test to guc.sql. The sql interface also
> accepts both numeric and percent forms although the percent form must be
> quoted because '%' is an operator.
>
> show cursor_tuple_fraction; --> 10%
> set cursor_tuple_fraction = .15; --> 15%
> set cursor_tuple_fraction = '33%'; --> 33%
>
> I tagged four configuration variables to display as percents.

I'm not sure I agree that percentages are better than fractions. I'd
vote a -0.5 for changing the default display format. There isn't much
harm in accepting them as a secondary format, though.

We should only accept percentages for settings where that makes sense.
It is sensible for most of the PGC_REAL settings, but not so much for
geqo_selection_bias or seed, for example.

Overall, I feel that this isn't really worth the trouble. We use
fractions consistently now, so there isn't much room for confusion over
what the current values mean. Using a percentage might be more familiar
for some people, but OTOH you'll have to get used to the fractions
anyway, unless we change the default output format too, and I'm not in
favour of doing that. I suggest that we just drop this, and remove the
TODO item.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2014-12-15 13:58:39 Re: Commit fest 2014-12, let's begin!
Previous Message Alexander Korotkov 2014-12-15 13:45:47 Re: Commit fest 2014-12, let's begin!