Re: [GENERAL] Autovacuum stuck for hours, blocking queries

Поиск
Список
Период
Сортировка
Искать
От
Tim Bellis
Тема
Re: [GENERAL] Autovacuum stuck for hours, blocking queries
Дата
Msg-id
CY1PR02MB20090758517703C892F7467FF95D0@CY1PR02MB2009.namprd02.prod.outlook.com
Ответ на
Список
Дерево обсуждения
[GENERAL] Autovacuum stuck for hours, blocking queries Tim Bellis <Tim.Bellis@metaswitch.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Hannes Erven <hannes@erven.at>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Tim Bellis <Tim.Bellis@metaswitch.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Hannes Erven <hannes@erven.at>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Rakesh Kumar <rakeshkumar464@outlook.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Scott Marlowe <scott.marlowe@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Michael Paquier <michael.paquier@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Tim Bellis <Tim.Bellis@metaswitch.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Tom Lane <tgl@sss.pgh.pa.us>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Merlin Moncure <mmoncure@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Bill Moran <wmoran@potentialtech.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Merlin Moncure <mmoncure@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Tim Bellis <Tim.Bellis@metaswitch.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Adrian Klaver <adrian.klaver@aklaver.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Tim Bellis <Tim.Bellis@metaswitch.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Jeff Janes <jeff.janes@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Scott Marlowe <scott.marlowe@gmail.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [GENERAL] Autovacuum stuck for hours, blocking queries Scott Marlowe <scott.marlowe@gmail.com>
The DELETE operations only deletes rows from the previous day. It's possible that there have been rows added that day which ought not to be deleted, so TRUNCATE wouldn't work.

But that was a helpful suggestion - thanks!

Tim

-----Original Message-----
From: Hannes Erven [mailto:hannes@erven.at] 
Sent: 17 February 2017 11:47
To: pgsql-general@postgresql.org
Cc: Tim Bellis 
Subject: Re: [GENERAL] Autovacuum stuck for hours, blocking queries

Hi Tim,



Am 2017-02-15 um 18:30 schrieb Tim Bellis:
> I have a postgres 9.3.4 database table which (intermittently but 
> reliably)
 > gets into a state where queries get blocked indefinitely  > [..]
> Notes:
>   - This database table is used for about 6 million row writes per 
> day,
 >     all of which are then deleted at the end of the day.

If you are dumping the contents of the table anyways, why not use TRUNCATE instead of DELETE? It unlinks and recreates the table data files, requiring nearly zero IO and analyzing.
Or even drop, and recreate the table with the correct new structure so you do not even need to ALTER TABLE ?

I'm a bit skeptical of these suggestions since very competent people have already answered your post and did not come up with this... ;-) the only drawback I'm aware of is that TRUNCATE will immediatly free disk space on the OS level, so the table's space will not be "blocked". But probably the VACUUM you are currently performing will also eventually release the unused disk space, so this may or may not match the current behaviour.


Best regards,

	-hannes


В списке pgsql-general по дате отправления
От: Jean-Michel Scheiwiler
Дата:
От: Alan Hodgson
Дата:
FAQ