| От | Joseph Shraibman |
|---|---|
| Тема | trigger speed |
| Дата | |
| Msg-id | ebtbpp$12ki$1@news.hub.org обсуждение исходный текст |
| Ответы |
Re: trigger speed
|
| Список | pgsql-general |
I have a trigger that updates a count table, based on status. The count table looks like this: key status count a 1 300 a 2 400 b 1 100 b 2 200 The problem is that for large updates when I do "UPDATE table SET status = 1 WHERE status = 2 and key = 'a';" the row level trigger fires for each row updated, decrementing the a 2 row and incrmenting the a 1 row. For large updates this really slows things down. Question #1: how do I speed this up? I need a way to run a trigger on all rows at once. Q #2: how do satement level triggers work? The examples in the pg docs only show row level triggers.
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера