Re: Parameter value from (mb/gb) to bytes - Mailing list pgsql-general

From Pavel Stehule
Subject Re: Parameter value from (mb/gb) to bytes
Date
Msg-id CAFj8pRA3g=B81ux8xBtQU+vfeZLjeFQThtTcCLM9JHCC7wN0Rw@mail.gmail.com
Whole thread Raw
In response to Re: Parameter value from (mb/gb) to bytes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general


st 14. 10. 2020 v 17:10 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
Magnus Hagander <magnus@hagander.net> writes:
> On Wed, Oct 14, 2020 at 3:57 PM Thomas Kellerer <shammat@gmx.net> wrote:
>> select pg_size_bytes(setting) * 8192
>> from pg_settings
>> where name = 'shared_buffers';

> Actually, it doesn't have to be in 8k pages, that depends on the build
> options. So if you want to be perfectly correct, you should probably
> multiply with current_setting('block_size') instead of a hardcoded 8192 :)

It's fairly annoying that this doesn't work:

regression=# select pg_size_bytes(setting||' '||unit) from pg_settings where name = 'shared_buffers';
ERROR:  invalid size: "16384 8kB"
DETAIL:  Invalid size unit: "8kB".
HINT:  Valid units are "bytes", "kB", "MB", "GB", and "TB".

Maybe we should teach pg_size_bytes to cope with that.

"8kB" is strange unit - maybe we can introduce new - "page"



                        regards, tom lane


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Parameter value from (mb/gb) to bytes
Next
From: Anthony DeBarros
Date:
Subject: PostGIS missing from EDB Windows installer for PG13?