Re: Elide null updates - Mailing list pgsql-hackers

From James Mansion
Subject Re: Elide null updates
Date
Msg-id 49482475.7010008@mansionfamily.plus.com
Whole thread Raw
In response to Re: Elide null updates  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers
Andrew Dunstan wrote:
> I don't follow what you're saying.
>
> If an update is skipped by a trigger, nothing new is written to disk, 
> and there should be nothing to vacuum from it. That's why this trigger 
> can speed up certain update queries enormously.
OK I'll try again.

Suppose we do an update.

This will:- write the new image and do the MVCC housekeeping- logically lock the updated row- fire update triggers

Suppose the pre-update trigger elides the update - ALL of the above is 
removed.

Now, one of the objections to making it the default behaviour is that 
the side effects (such as the lock and the trigger) might be desirable, 
or at least that removing them is a change in behaviour.

I'm wondering whether it would be possible to remove the physical update 
but retain the logical side effects,, so this argument about changed 
semantics is removed, and the only issue is whether the cost of 
identifying the noop update is worthwhile given the savings achieved, 
which will be application dependent.

James

(I suspect that if you step back from the implementation of the SQL 
engine as a series of procedural steps on rows - and think of it in 
terms of relational set algebra, then it is entirely defensible to elide 
such an update as a matter of course and that it SHOULD happen - but 
then there is always fun and games around inserting duplicates too, and 
I suspect most of us don't think in algebra terms)



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Another issue in default-values patch: defaults expanded too soon
Next
From: Tom Lane
Date:
Subject: Re: Elide null updates