[HACKERS] Early locking option to parallel backup

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

Hello people,

I am sending a patch to improve parallel backup on larger databases.

THE PROBLEM

pg_dump was taking more than 24 hours to complete in one of my databases. I begin to research alternatives. Parallel backup reduced the backup time to little less than a hour, but it failed almost every time because of concurrent queries that generated exclusive locks. It is difficult to guarantee that my applications will not issue queries such as drop table, alter table, truncate table, create index or drop index for a hour. And I prefer not to create controls mechanisms to that end if I can work around it.

THE SOLUTION

The patch creates a "--lock-early" option which will make pg_dump to issue shared locks on all tables on the backup TOC on each parallel worker start. That way, the backup has a very small chance of failing. When it does, happen in the first few seconds of the backup job. My backup scripts (not included here) are aware of that and retries the backup in case of failure.

TESTS
I am using this technique in production over a year now and it is working well for me.


Lucas

Вложения

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

Предыдущее
От: Connor Wolf
Дата:
Сообщение: Re: [HACKERS] How to implement a SP-GiST index as a extension module?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Early locking option to parallel backup