Re: SQL spec/implementation question: UPDATE

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL spec/implementation question: UPDATE
Date: 2007-10-22 03:33:26
Message-ID: 471C1A06.2060701@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 10/21/07 17:52, Tom Lane wrote:
> 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.

Not to bash MySQL (much...) but ISTM that this is another example of
MySQL playing fast and loose with SQL.

IOW, the RDBMS shouldn't try to out-think me even if I seem seem to
be doing something odd.

- --
Ron Johnson, Jr.
Jefferson LA USA

Give a man a fish, and he eats for a day.
Hit him with a fish, and he goes away for good!

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHHBoGS9HxQb37XmcRAnGwAKCmiUnUvXHDyGs5Z0q0dZYlVOFaUgCcClhu
hwwRK9w9RhFM9lmAPZl2oP8=
=6Tso
-----END PGP SIGNATURE-----

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shwe Yee Than 2007-10-22 03:35:05 command to view the tables
Previous Message Ow Mun Heng 2007-10-22 03:20:51 Re: looking for some real world performance numbers