Re: update ... from where id in (..) question

From: Joel Burton <jburton(at)scw(dot)org>
To: Feite Brekeveld <feite(dot)brekeveld(at)osiris-it(dot)nl>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: update ... from where id in (..) question
Date: 2001-05-02 21:57:34
Message-ID: Pine.LNX.4.21.0105021755560.21206-100000@olympus.scw.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)scw(dot)org>
Director of Information Systems, Support Center of Washington

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joel Burton 2001-05-02 21:59:37 Re: Security and performance
Previous Message David Scholes 2001-05-02 21:57:02 Tuple Max Size on 7.1