Re: Do foreign key triggers get ran even if the key's value doesn't change?

Поиск
Список
Период
Сортировка
От Jeff Janes
Тема Re: Do foreign key triggers get ran even if the key's value doesn't change?
Дата
Msg-id CAMkU=1ywjnX45p9X4LM4Kz_9wwyzj5nTDgiXqYwnop2NJdAfVA@mail.gmail.com
обсуждение исходный текст
Ответ на Do foreign key triggers get ran even if the key's value doesn't change?  (Joe Van Dyk <joe@tanga.com>)
Ответы Re: Do foreign key triggers get ran even if the key's value doesn't change?
Список pgsql-general

On Wed, May 21, 2014 at 1:11 PM, Joe Van Dyk <joe@tanga.com> wrote:
I came across http://bonesmoses.org/2014/05/14/foreign-keys-are-not-free/
which seems to indicate so.

When I run the following test script, having 50 foreign keys takes
about twice as long to do the update. Is there a reason for that?
Seems like the RI triggers wouldn't have to run on updates if the
value doesn't change.

That's kind of a question of definitions.  Perhaps the trigger itself doesn't need to run, but the code that decides whether the trigger needs to run does need to run.  Where do you draw the line around what is the trigger proper and what is just infrastructure?  

However you wish to define it, change your function so that it actually does change the key field, and see how much slower that is than the behavior where you update the row without updating the key.  
 
Cheers,

Jeff

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

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: postgres 9.2.4 - ERROR: invalid input syntax for type numeric: ""
Следующее
От: Laurentius Purba
Дата:
Сообщение: Question regarding DEALLOCATE pdo_stmt_00000001