Re: Linear slow-down while inserting into a table with an ON INSERT trigger ?
От
David Rowley
Тема
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ?
Дата
Msg-id
CAApHDvr-kFAmOihG1FxVZfgdV_e5TR8cU3n+QPkYwJ8XqmA4YQ@mail.gmail.com
Ответ на
Список
Дерево обсуждения
Linear slow-down while inserting into a table with an ON INSERT trigger ? Tobias Gierke <tobias.gierke@code-sourcery.de>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Justin Pryzby <pryzby@telsasoft.com>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Tobias Gierke <tobias.gierke@code-sourcery.de>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Laurenz Albe <laurenz.albe@cybertec.at>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? David Rowley <dgrowleyml@gmail.com>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Tom Lane <tgl@sss.pgh.pa.us>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Tobias Gierke <tobias.gierke@code-sourcery.de>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Benjamin Scherrey <scherrey@proteus-tech.com>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Ninad Shah <nshah.postgres@gmail.com>
Re: Linear slow-down while inserting into a table with an ON INSERT trigger ? Tobias Gierke <tobias.gierke@code-sourcery.de>
On Sat, 17 Jul 2021 at 16:40, Justin Pryzby wrote: > You could run a single UPDATE rather than 30k triggers. > Or switch to an INSERT on the table, with an index on it, and call > max(last_parent_table_change) from whatever needs to ingest it. And prune the > old entries and vacuum it outside the transaction. Maybe someone else will > have a better suggestion. Maybe just change the UPDATE statement to: UPDATE data_sync SET last_parent_table_change=CURRENT_TIMESTAMP WHERE last_parent_table_change <> CURRENT_TIMESTAMP; That should reduce the number of actual updates to 1 per transaction. David
В списке pgsql-performance по дате отправления
От: Benjamin Scherrey
Дата:
От: Tom Lane
Дата: