Re: UPDATE with subquery too slow - Mailing list pgsql-performance

From Leeuw van der, Tim
Subject Re: UPDATE with subquery too slow
Date
Msg-id DD0DC14935B1D211981A00105A1B28DB0A7B4D63@NL-ASD-EXCH-1
Whole thread Raw
In response to UPDATE with subquery too slow  ("Eric Jain" <Eric.Jain@isb-sib.ch>)
List pgsql-performance
Hi,

This is not going to answer your question of course but did you already try to do this in 2 steps?

You said that the subquery itself doesn't take very long, so perhaps you can create a temporary table based on the
subquery,then in the update do a join with the temporary table? 

This might not be desirable in the end, but it might be useful just to check the performance of it.

And - isn't it an option to upgrade to 7.4.1 instead?


regards,

--Tim

THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the
intendedrecipient. If you received this in error, please contact the sender and delete the e-mail and its attachments
fromall computers.  



-----Original Message-----
From: pgsql-performance-owner@postgresql.org
[mailto:pgsql-performance-owner@postgresql.org]On Behalf Of Eric Jain
Sent: dinsdag 17 februari 2004 13:38
To: pgsql-performance
Subject: [PERFORM] UPDATE with subquery too slow


I can't get the following statement to complete with reasonable time.
I've had it running for over ten hours without getting anywhere. I
suspect (hope) there may be a better way to accomplish what I'm trying
to do (set fields containing unique values to null):

  UPDATE requests
  SET session = NULL
  WHERE session IN
  (
    SELECT session
    FROM requests
    GROUP BY session
    HAVING COUNT(*) = 1
  );

[...]


pgsql-performance by date:

Previous
From: "Eric Jain"
Date:
Subject: UPDATE with subquery too slow
Next
From: Konstantin Tokar
Date:
Subject: Tables on multiple disk drives