Table copy with SERIALIZABLE is incredibly slow

Поиск
Список
Период
Сортировка
От peter plachta
Тема Table copy with SERIALIZABLE is incredibly slow
Дата
Msg-id CAGTqnmYptofgKW6X+MhuA1RiFQPX0CbCPcE4B38rC-62S8Kc1w@mail.gmail.com
обсуждение исходный текст
Ответы Re: Table copy with SERIALIZABLE is incredibly slow  (Laurenz Albe <laurenz.albe@cybertec.at>)
Список pgsql-performance
Hi all

Background is we're trying a pg_repack-like functionality to compact a 500Gb/145Gb index (x2) table from which we deleted 80% rows. Offline is not an option. The table has a moderate (let's say 100QPS) I/D workload running.

The typical procedure for this type of thing is basically CDC:

1. create 'log' table/create trigger
2. under SERIALIZABLE: select * from current_table insert into new_table

What we're finding is that for the 1st 30 mins the rate is 10Gb/s, then it drops to 1Mb/s and stays there.... and 22 hours later the copy is still going and now the log table is huge so we know the replay will also take a very long time.

===

Q: what are some ways in which we could optimize the copy?

Btw this is Postgres 9.6

(we tried unlogged table (that did nothing), we tried creating indexes after (that helped), we're experimenting with RRI)

Thanks!

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

Предыдущее
От: peter plachta
Дата:
Сообщение: Results of experiments with UUIDv7, UUIDv8
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Table copy with SERIALIZABLE is incredibly slow