Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kShHq-0000cp-JF for pgsql-general@arkaria.postgresql.org; Wed, 14 Oct 2020 13:57:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kShHp-0007E3-H5 for pgsql-general@arkaria.postgresql.org; Wed, 14 Oct 2020 13:57:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kShHp-0007Dw-9B for pgsql-general@lists.postgresql.org; Wed, 14 Oct 2020 13:57:49 +0000 Received: from mout.gmx.net ([212.227.17.20]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kShHn-00006F-9d for pgsql-general@lists.postgresql.org; Wed, 14 Oct 2020 13:57:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1602683866; bh=YMEBtR6laHJooKHOuSmtYltCmseYFcb0Mro+O9So3tY=; h=X-UI-Sender-Class:Subject:To:References:From:Date:In-Reply-To; b=hBTop/IhurmMcgEnB4zi+mBJKo6uIss8yOSWjMJhstxUpSk/0Enx/jhfUKetLbjTo kMVncHhbxQF5GKKB0xTQ3W47PT2R/2KfR+n1/9+GUs4/QICjCmY19udzWOBHvRlNb8 OKIf6iF3CjdYX5Vr4US9bSXSUjCLHu80SA+osCTc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from [10.1.35.238] ([185.40.248.10]) by mail.gmx.com (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1N8ofO-1kMuHU293e-015o0P for ; Wed, 14 Oct 2020 15:57:46 +0200 Subject: Re: Parameter value from (mb/gb) to bytes To: pgsql-general@lists.postgresql.org References: <6cbca2bcda734464a1be9f7d7380ff33@rik.ee> From: Thomas Kellerer Message-ID: Date: Wed, 14 Oct 2020 15:57:45 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: de-DE Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:DnTlkLGk3Lr96YVkxpCOwgcjmlWYEZrzBaX7FpJmYReyps8yD0o 6JgvLhNH1RfrqAiQl+azRL6AlgBJKtYD67AV+hZCHtnfuUuUiMa91RZWstN+CApd8j9XcFW RpwiqxpHRQ2FgMNdFaNfzTBgYRyHqu4lYh0qCOYGu00blrhq6t0OHcjtcWvsTfEipidcJLg 2u6kiZZKiR61SmgcOkqVg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:2JJRHnxuonI=:wrg/FqT5PDLAey9cGHcy58 Fxv8lj6OirIdUYjA7xgwYVW2Q5uoWBFkzM4eLAyUGNke8nisX4w/1dFiFJoZzAx1n8SffHqMn +oc6Wrl+2m7zwFZ6spk2Nf+cBUcDxM7KNpnj5T+CSXhSJdTE4BmlilG/MlOupZDAMdxaOP+Q3 BOB36jBsAg1dBcBq1bce+rBAhAhceAzUhf9Z6kvaPugtY0c2iSmXOJipUBDB5Dt1N5Ncp9OA0 dXGwCxRstFXYTv3MDcjTK58IMttnVa2LF8PI/rtBvOAYjtuN+tfMKcWJe0LtTacpEZ00783hp E6xpR2h4Mi9aXlZyIPG/Z/qsmhlpxN5GriZLUiE/ZlyGTZ84QhOy91bOn5hIr9ynXkopppN5Q Ib0P1plr80VXsjtV084PQWI0qgF24ja6vEAVHvUxpTap4Bc9aVZSb/U6HM7fmXgMykL2qryu3 3npb7RlLbMrcO3ZYiznwckfXKVaJIf1u22LKX8lKecNZrr+wBZDJNy7gkR8DRZmDUv4f5QauK zUY6ZGPe60dXHomnLa36YvtxEWHxZS4My03clAejsTgQm+0ERCRWgchtNQSfIo5UPI/MWaqLn mZ41SFZARjP/jjnVdWzcgorZTNB4oHz62oTLP1DyoJTmLpHCmp7F75TwDUbyJzp775a8R3XAJ jpzPddMbQQAXleC4TKNrrhFt0pKfqKuhcaW4RMxdBhBGKDsPkfhY+xuqb+16wcfmx4UrV7B5O ptUMMd1PtRcnfRd7Lu3oa1WoFaTv8fQmjUBQ+F5xkuz6PCqxFFbNHDNKf8dYu/LygQkA7ygwM LGI3p87XQJpIHW8PR4KDWj5iJVOOdjKfKC/Zg3vYfgUeNnyczcx+M+G14zKzXFOmOfoDBGdva 6qHD2Oy5PoWku5rT9+2w== List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Kellerer schrieb am 14.10.2020 um 15:55: > Raul Kaubi schrieb am 14.10.2020 um 12:22: >> Is there a simple way to dynamically get for example parameter >> =E2=80=9Eshared buffers=E2=80=9C value (megabytes or gigabytes) to byte= s, for >> monitoring perspective..?> >> =C2=A0 >> >> 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 g= et 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 =3D 'shared_buffers'; Ah, forgot that shared_buffers is in 8K pages. So you actually need: select pg_size_bytes(setting) * 8192 from pg_settings where name =3D 'shared_buffers';