Re: left join with smaller table or index on (XXX is not null) to avoid upsert

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
Cc: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: left join with smaller table or index on (XXX is not null) to avoid upsert
Date: 2009-01-19 16:43:39
Message-ID: 6929.1232383419@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com> writes:
> But seriously, it's doing what you told it to do. There might be
> corner cases where you need a trigger to fire for a row on change, and
> short-circuiting could cause things to fail in unexpected ways.

The other argument against doing this by default is that with
non-stupidly-written applications, the cycles expended to check for
vacuous updates would invariably be wasted. Even if the case did
come up occasionally, it's not hard at all to foresee that the extra
checking could be a net loss overall.

But having said that: 8.4 will provide a standard trigger that
short-circuits vacuous updates, which you can apply to tables in which
you think vacuous updates are likely. It's your responsibility to place
the trigger so that it doesn't interfere with any other trigger
processing you may have.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Grzegorz Jaśkiewicz 2009-01-19 16:48:27 Re: left join with smaller table or index on (XXX is not null) to avoid upsert
Previous Message Ivan Sergio Borgonovo 2009-01-19 15:10:51 Re: How can I look at a recursive table dependency tree?