Re: Deprecating RULES

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Deprecating RULES
Дата
Msg-id 507C1317.9020200@dunslane.net
обсуждение исходный текст
Ответ на Re: Deprecating RULES  (Simon Riggs <simon@2ndQuadrant.com>)
Ответы Re: Deprecating RULES
Список pgsql-hackers
On 10/15/2012 09:07 AM, Simon Riggs wrote:
> On 15 October 2012 11:41, Greg Stark <stark@mit.edu> wrote:
>> On Mon, Oct 15, 2012 at 8:00 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>>> Please can anyone show me the SQL for a rule that cannot be written as
>>> a view or a trigger? I do not believe such a thing exists and I will
>>> provide free beer to the first person that can prove me wrong.
>> Being written as a view doesn't help you because views use rules. I
>> repeat, the very fact that we need rules to implement views prove
>> rules are necessary for some purposes.
> No, it just means there is some aspect of similar underlying infrastructure.
>
> Denial of free beer looks like proof to me...
>


*sigh*

First, as Tom said, the onus of proof is on you. You can't transfer it 
away with this offer of free beer.

Second, he's actually told you one advantage rules can have over 
triggers, but you've pretty much chosen to ignore it:

> Triggers necessarily operate on a row-at-a-time basis.  In theory,
> for at least some bulk operations, a rule could greatly outperform
> a trigger.  It's difficult to walk away from that - unless somebody
> can prove that the advantage doesn't ever accrue in practice.

I have seen rules used instead of triggers for precisely this reason. 
Yes, the fact that COPY bypasses rules is something you need to 
remember, but that makes it a limitation of the feature, not an absolute 
reason not to use it. (I rarely if ever use them myself - can't recall 
the last time I did, but there is plenty of legacy use out there.)

cheers

andrew




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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Deprecating RULES
Следующее
От: Amit kapila
Дата:
Сообщение: Re: patch submission: truncate trailing nulls from heap rows to reduce the size of the null bitmap [Review]