Re: SQL spec/implementation question: UPDATE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: andy <andy(at)squeakycode(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL spec/implementation question: UPDATE
Date: 2007-10-21 22:52:15
Message-ID: 17665.1193007135@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

andy <andy(at)squeakycode(dot)net> writes:
> I think your comparing apples and oranges. I'll bet that mysql is
> taking a shortcut and testing the value before updating it.

> The update is probably more close to:
> update test set name = 'kevin' where passion = 'soccer' and name <> 'kevin';

Yeah, that seems to be what they're doing. PG does not bother to make
such a test, on the grounds that it would waste more net cycles than it
would save. Most people are not in the habit of issuing lots of no-op
updates.

Also, if you have a case where you think that is what will happen, you
can add the WHERE-condition for yourself; whereas there is no way in
mysql to get rid of the useless test even if you know it's useless.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guy Rouillier 2007-10-22 02:54:20 Re: looking for some real world performance numbers
Previous Message Adrian Klaver 2007-10-21 22:08:03 Re: Select Command