Re: update ... from where id in (..) question - Mailing list pgsql-general

From Joel Burton
Subject Re: update ... from where id in (..) question
Date
Msg-id Pine.LNX.4.21.0105021755560.21206-100000@olympus.scw.org
Whole thread Raw
In response to update ... from where id in (..) question  (Feite Brekeveld <feite.brekeveld@osiris-it.nl>)
Responses Re: Re: update ... from where id in (..) question  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On Wed, 2 May 2001, Feite Brekeveld wrote:

> Hi,
>
> I have a table with approx.  2mln records.
>
> There were a few for which I had to update statusfield, so I did:
>
>         update table set statusflag = 'U' where id in ('id10', 'id20',
> 'id30');
>
> this took so long that I cancelled it, and used separate
>
>         update table set statusflag = 'U' where id = 'id10';
>
> statements, which were executed in a fraction of a second.
>
> Has someone an explanation for this ?

1) Next time, try WHERE ID = 'id10' OR ID = 'id20' OR ... and see if
that's better.

2) Explanation for this? Have you tried EXPLAIN UPDATE table ....
Post the output of that, and someone might be able to help you decipher
it.


HTH,
--
Joel Burton   <jburton@scw.org>
Director of Information Systems, Support Center of Washington


pgsql-general by date:

Previous
From: David Scholes
Date:
Subject: Re: Tuple Max Size on 7.1
Next
From: Andy Koch
Date:
Subject: Re: DROP TABLE wildcard