pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Kellerer <shammat@gmx.net>
To: pgsql-general@lists.postgresql.org
Subject: Re: Parameter value from (mb/gb) to bytes
Date: Wed, 14 Oct 2020 15:55:41 +0200
Message-ID: <f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net> (raw)
In-Reply-To: <6cbca2bcda734464a1be9f7d7380ff33@rik.ee>
References: <6cbca2bcda734464a1be9f7d7380ff33@rik.ee>

Raul Kaubi schrieb am 14.10.2020 um 12:22:
> Is there a simple way to dynamically get for example parameter
> „shared buffers“ value (megabytes or gigabytes) to bytes, for
> monitoring perspective..?>
>  
>
> At the moment, this gives me value in GB.
>
> # psql -U postgres -Atc "show shared_buffers;"
> 1GB
>
> This value may as well be in MB. So I am looking a way to dynamically get the value in bytes.

Instead of using "show" you can use a SELECT with pg_size_bytes():

  select pg_size_bytes(setting)
  from pg_settings
  where name = 'shared_buffers';










view thread (12+ messages)  latest in thread

Message-ID: <f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net>
Permalink:  ../f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net/
Also on:    postgresql.org/message-id/f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: shammat@gmx.net
  Subject: Re: Parameter value from (mb/gb) to bytes
  In-Reply-To: <f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net>
  References: <6cbca2bcda734464a1be9f7d7380ff33@rik.ee> <f95d954f-6467-a50a-f8fc-8bf4bb80e902@gmx.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox