Re: How to monitor Postgres real memory usage

From: 徐志宇徐 <xuzhiyuster(at)gmail(dot)com>
To: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: How to monitor Postgres real memory usage
Date: 2022-05-26 15:36:44
Message-ID: CAOCebiLgKWe1Erbt-mqWrg6fhv_bBF-O4atZvWQaYoi+rTDvEQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hi Justin

Thanks for your update.

Postgres is just an OS Process, so should be monitored like any other.

What OS are you using ?

> I am using Centos 7.5.

Know that the OS may attribute "shared buffers" to different processes, or
multiple processes.

It's almost always a bad idea to kill postgres with kill -9.

> I unable to connect to database server. I have to kill some process to
release memory. Then I could connect it.

What settings have you used in postgres ?
https://wiki.postgresql.org/wiki/Server_Configuration

> Please reference my attachment.

You can check memory use of an individual query with "explain
(analyze,buffers) .."
https://wiki.postgresql.org/wiki/Slow_Query_Questions

Thanks for your update. This memory allocation failed issue impact the
whole database running. not a slow query.
Is there any commands or method could get totally Postgres memory
utilization ? Thanks .

Justin Pryzby <pryzby(at)telsasoft(dot)com> 于2022年5月25日周三 01:40写道:

> On Wed, May 25, 2022 at 12:25:28AM +0800, 徐志宇徐 wrote:
> > Hi All
> >
> > I am a Database DBA. I focus on PostgreSQL and DB2.
> > Recently. I experience some memory issue. The postgres unable allocate
> > memory. I don't know how to monitor Postgres memory usage.
>
> Postgres is just an OS Process, so should be monitored like any other.
>
> What OS are you using ?
>
> Know that the OS may attribute "shared buffers" to different processes, or
> multiple processes.
>
> > This server have 16G memory. On that time. The free command display
> only 3
> > G memory used. The share_buffers almost 6G.
> >
> > On that time. The server have 100 active applications.
> > New connection failed. I have to kill some application by os command
> "kill -9"
>
> It's almost always a bad idea to kill postgres with kill -9.
>
> > The checkpoint command execute very slow. almost need 5-10 seconds.
>
> Do you mean an interactive checkpoint command ?
> Or logs from log_checkpoint ?
>
> > Is there any useful command to summary PostgreSQL memory usage ?
>
> You can check memory use of an individual query with "explain
> (analyze,buffers) .."
> https://wiki.postgresql.org/wiki/Slow_Query_Questions
>
> What settings have you used in postgres ?
> https://wiki.postgresql.org/wiki/Server_Configuration
>
> What postgres version ?
> How was it installed ? From souce? From a package ?
>
> --
> Justin
>

Attachment Content-Type Size
postgresql.auto.conf application/octet-stream 1.2 KB
postgresql.conf application/octet-stream 23.2 KB

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message 徐志宇徐 2022-05-26 15:47:40 Re: How to monitor Postgres real memory usage
Previous Message Justin Pryzby 2022-05-24 17:40:50 Re: How to monitor Postgres real memory usage