slow down on UPDATE using IN statements - Mailing list pgsql-general

From MaRcElO PeReIrA
Subject slow down on UPDATE using IN statements
Date
Msg-id 20031103135244.84903.qmail@web20202.mail.yahoo.com
Whole thread Raw
Responses Re: slow down on UPDATE using IN statements  (Martijn van Oosterhout <kleptog@svana.org>)
Re: slow down on UPDATE using IN statements  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Re: slow down on UPDATE using IN statements  (<mallah@trade-india.com>)
List pgsql-general
Hi there,

I was in troubles with a UPDATE+IN statement:

The following command use to take about 5 minutes to
be done:

UPDATE requisicao SET conclusao='3' WHERE reg IN
(SELECT reg FROM requisicao WHERE now()-data>'15
days');

The table 'requisicao' has only about 400 lines (!!).

If I change it to:

UPDATE requisicao SET conclusao='3' WHERE reg IN (12,
45, 87, 98, 129, 350, 389);

I have detected that the major problem isn't in the
amount of lines changed, but in the subselect.

How can I solve/optimize it? I would like to use the
IN, but in the last case I would make a software
change.

Thanks in advance and
Best regards,

Marcelo Pereira
Brazil

Yahoo! Mail - o melhor webmail do Brasil
http://mail.yahoo.com.br

pgsql-general by date:

Previous
From: "Jennifer Lee"
Date:
Subject: plpgsql question
Next
From: Martijn van Oosterhout
Date:
Subject: Re: slow down on UPDATE using IN statements