Обсуждение: PostgreSQL Out of Memory

Поиск
Список
Период
Сортировка

PostgreSQL Out of Memory

От
liam saffioti
Дата:
Hi Teams,

I have PG 14.5 on RHEL 8.4. I see many errors. Do you have any idea about this problem?

TopMemoryContext: 1194808 total in 12 blocks; 3968 free (3 chunks); 1190840 used
  TopTransactionContext: 592728 total in 9 blocks; 30328 free (4 chunks); 562400 used
    ExecutorState: 551680 total in 8 blocks; 147192 free (31 chunks); 404488 used
      BTree array context: 4096 total in 3 blocks; 3488 free (9 chunks); 608 used
      TupleSort main: 3153976 total in 2 blocks; 6728 free (7 chunks); 3147248 used
        TupleSort sort: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
          Caller tuples: 16777216 total in 12 blocks; 624 free (13 chunks); 16776592 used
      ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
      ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
      MemoizeHashTable: 8192 total in 1 blocks; 7320 free (0 chunks); 872 used
      ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
      ExprContext: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
....

FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  out of memory
FATAL:  out of memory
...

Re: PostgreSQL Out of Memory

От
Mladen Gogala
Дата:
On 9/5/22 07:54, liam saffioti wrote:
Hi Teams,

FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  terminating background worker "parallel worker" due to administrator command
FATAL:  out of memory
FATAL:  out of memory
...

You are allowing over-committing memory, which in turn activates OOMK (Out of Memory Killer) when the memory runs out. You have to restrict the number of connections or parameters like work_mem and hash_mem_multiplier. There is also a good article on Squishy Data:

https://www.crunchydata.com/blog/deep-postgresql-thoughts-the-linux-assassin

Basically, you should start with vm.overcommit_memory = 2

-- 
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

Re: PostgreSQL Out of Memory

От
Jeff Janes
Дата:
On Mon, Sep 5, 2022 at 7:55 AM liam saffioti <liam.saffiotti@gmail.com> wrote:
Hi Teams,

I have PG 14.5 on RHEL 8.4. I see many errors. Do you have any idea about this problem?

TopMemoryContext: 1194808 total in 12 blocks; 3968 free (3 chunks); 1190840 used
  TopTransactionContext: 592728 total in 9 blocks; 30328 free (4 chunks); 562400 used
    ExecutorState: 551680 total in 8 blocks; 147192 free (31 chunks); 404488 used
      BTree array context: 4096 total in 3 blocks; 3488 free (9 chunks); 608 used
      TupleSort main: 3153976 total in 2 blocks; 6728 free (7 chunks); 3147248 used
        TupleSort sort: 8192 total in 1 blocks; 7928 free (0 chunks); 264 used
          Caller tuples: 16777216 total in 12 blocks; 624 free (13 chunks); 16776592 used

The problem context is probably hiding inside the ellipsis.

What is the single largest line (according to the first numeric field) from this report?
 
Cheers,

Jeff