Re: Understanding Postgres Memory Usage

Поиск
Список
Период
Сортировка
От Ilya Kazakevich
Тема Re: Understanding Postgres Memory Usage
Дата
Msg-id 04e301d1fee9$537ab200$fa701600$@JetBrains.com
обсуждение исходный текст
Ответ на Understanding Postgres Memory Usage  (Theron Luhn <theron@luhn.com>)
Ответы Re: Understanding Postgres Memory Usage  (Theron Luhn <theron@luhn.com>)
Список pgsql-general

$ free -h  # Before the query

             total       used       free     shared    buffers     cached

Mem:          7.8G       5.2G       2.6G       212M        90M       4.9G

-/+ buffers/cache:       248M       7.6G

Swap:           0B         0B         0B

$ free -h  # After the query

             total       used       free     shared    buffers     cached

Mem:          7.8G       5.3G       2.5G       212M        90M       4.9G

-/+ buffers/cache:       312M       7.5G

Swap:           0B         0B         0B

 

[I.K >> ] Are you talking about buffers/cache increased? AFAIK this memory is used by kernel as buffer before any block device (HDD for example).

Postgres does not use this memory directly, it simply reads data from block device, and kernel caches it. Process can’t be OOMed because of it.

 

 

I am sure you should configure your Postgres to NEVER exceed available RAM. You may use tools like (http://pgtune.leopard.in.ua/) or calculate it manually.

I do not remember exact formula, but it should be something like “work_mem*max_connections + shared_buffers” and it should be around 80% of your machine RAM (minus RAM used by other processes and kernel).

It will save you from OOM.

 

If you  face performance bottleneck after it, you fix it using tools like “log_min_duration_statement”, “track_io_timing” and system-provided tools.

 

 

 

 

Ilya Kazakevich

 

JetBrains

http://www.jetbrains.com

The Drive to Develop

 

 

В списке pgsql-general по дате отправления:

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: pg_hba.conf : bad entry for ADDRESS
Следующее
От: arnaud gaboury
Дата:
Сообщение: Re: pg_hba.conf : bad entry for ADDRESS