slow update
slow update
От:
"Chad Thompson" <chad@weblinkservices.com>
Дата:
Hey guys/gals I have a update that is slow and I cant get my head around a way to make it faster. update table set id = '555' where id in (select id from different_table) pretty simple... i tried using exists as well.. but it still seems to be very slow. TIA Chad
Re: slow update
От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Wed, Apr 30, 2003 at 10:12:35 -0600, Chad Thompson wrote: > Hey guys/gals > I have a update that is slow and I cant get my head around a way to make it > faster. > > update table set id = '555' > where id in (select id from different_table) > > pretty simple... i tried using exists as well.. but it still seems to be > very slow. This will probably run faster in 7.4 as "in" has been improved. If id is a unique column in different table, then you might try the following: update table set id = '555' from different_table where table.id = different_table.id
Re: slow update
От:
"Chad Thompson" <chad@weblinkservices.com>
Дата:
Ooops, I see where my structure was wrong. It should have read, update table set TEMP_id = '555' where id in (select id from different_table) so im setting a field to 555 based on the id in different_table that matches the id in table. Does that make sense? Thanks Chad ----- Original Message ----- From: "Bruno Wolff III" To: "Chad Thompson" Cc: "pgsql-novice" Sent: Wednesday, April 30, 2003 11:33 AM Subject: Re: [NOVICE] slow update > On Wed, Apr 30, 2003 at 10:12:35 -0600, > Chad Thompson wrote: > > Hey guys/gals > > I have a update that is slow and I cant get my head around a way to make it > > faster. > > > > update table set id = '555' > > where id in (select id from different_table) > > > > pretty simple... i tried using exists as well.. but it still seems to be > > very slow. > > This will probably run faster in 7.4 as "in" has been improved. > > If id is a unique column in different table, then you might try the following: > update table set id = '555' from different_table where table.id = > different_table.id > > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faqs/FAQ.html >