Re: Autovacuum, dead tuples and bloat

Поиск
Список
Период
Сортировка
От Achilleas Mantzios
Тема Re: Autovacuum, dead tuples and bloat
Дата
Msg-id 2f2aafe6-3e29-4305-a279-1b3d56e9389e@cloud.gatewaynet.com
обсуждение исходный текст
Ответ на Autovacuum, dead tuples and bloat  ("Shenavai, Manuel" <manuel.shenavai@sap.com>)
Ответы RE: Autovacuum, dead tuples and bloat
Список pgsql-general
Στις 20/6/24 19:46, ο/η Shenavai, Manuel έγραψε:
@font-face {font-family:"Cambria Math"; panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face {font-family:Calibri; panose-1:2 15 5 2 2 2 4 3 2 4;}p.MsoNormal, li.MsoNormal, div.MsoNormal {margin:0cm; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ligatures:standardcontextual; mso-fareast-language:EN-US;}p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph {mso-style-priority:34; margin-top:0cm; margin-right:0cm; margin-bottom:0cm; margin-left:36.0pt; font-size:11.0pt; font-family:"Calibri",sans-serif; mso-ligatures:standardcontextual; mso-fareast-language:EN-US;}span.EmailStyle17 {mso-style-type:personal-compose; font-family:"Calibri",sans-serif; color:windowtext;}.MsoChpDefault {mso-style-type:export-only; font-family:"Calibri",sans-serif; mso-fareast-language:EN-US;}div.WordSection1 {page:WordSection1;}ol {margin-bottom:0cm;}ul {margin-bottom:0cm;}

Hi everyone,

 

we can see in our database, that the DB is 200GB of size, with 99% bloat. After vacuum full the DB decreases to 2GB.

DB total size: 200GB

DB bloat: 198 GB

DB non-bloat: 2GB

 

We further see, that during bulk updates (i.e. a long running transaction), the DB is still growing, i.e. the size of the DB growth by +20GB after the bulk updates.

 

My assumption is, that after an autovacuum, the 99% bloat should be available for usage again. But the DB size would stay at 200GB. In our case, I would only expect a growth of the DB, if the bulk-updates exceed the current DB size (i.e. 220 GB).

 

How could I verify my assumption?

 

I think of two possibilities:

  1. My assumption is wrong and for some reason the dead tuples are not cleaned so that the space cannot be reused
  2. The bulk-update indeed exceeds the current DB size. (Then the growth is expected).

 

Your only assumption should be the official manual, and other material such as books, articles from reputable sources, even reading the source as a last resort could be considered.

For starters : do you have autovacuum enabled ? If not, then enable this.

Then monitor for vacuum via pg_stat_user_tables, locate the tables that you would expect vacuum to have happened but did not, then consider autovacuum tuning.

Watch the logs for lines such as :

<N> dead row versions cannot be removed yet, oldest xmin: <some xid>

those are held from being marked as removed, due to being visible by long running transactions. Monitor for those transactions.

You have to monitor (if this is the case) about autovacuum being killed and not allowed to do its job.

Can you help me to verify these assumptions? Are there any statistics available that could help me with my verification?

 

Thanks in advance &

Best regards,

Manuel

-- 
Achilleas Mantzios IT DEV - HEAD IT DEPT Dynacom Tankers Mgmt (as agents only)

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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Autovacuum, dead tuples and bloat
Следующее
От: Šika Michal
Дата:
Сообщение: Re: Postgresql python in upgraded version 16.2