Received: from postgresql.org.org (webmail.postgresql.org [216.126.85.28]) by postgresql.org (8.11.3/8.11.1) with SMTP id f5CGEOE31982 for ; Tue, 12 Jun 2001 12:14:24 -0400 (EDT) (envelope-from pgsql-sql-owner@postgresql.org) Received: from news.tht.net (news.hub.org [216.126.91.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f56FSeE84610 for ; Wed, 6 Jun 2001 11:28:40 -0400 (EDT) (envelope-from news@news.tht.net) Received: (from news@localhost) by news.tht.net (8.11.1/8.11.1) id f56FNO603503 for pgsql-sql@postgresql.org; Wed, 6 Jun 2001 11:23:24 -0400 (EDT) (envelope-from news) From: iu_23@hotmail.com (Dawn) X-Newsgroups: comp.databases.postgresql.sql Subject: multiple sql update w/ major time issues Date: 6 Jun 2001 08:23:21 -0700 Organization: http://groups.google.com/ Lines: 38 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: groups-support@google.com To: pgsql-sql@postgresql.org X-Archive-Number: 200106/178 X-Sequence-Number: 3407 I have a sql update statement that is dealing with hundreds of thousands of records. It takes hours and hours to complete (if it does complete and not take down the server). Here is how I have it right now: update aud_member_ext_attributes b set EXTVALUE217 = (select a.MTD from gl_totals a where a.category = 'tankrent' and a.CUST_NO = b.EXTVALUE101 and a.DIST_NO = b.EXTVALUE102 and a.SUB_NO = b.EXTVALUE105 and a.FUEL_TYPE = b.EXTVALUE123); update aud_member_ext_attributes b set EXTVALUE223 = (select a.YTD from gl_totals a where a.category = 'tankrent' and a.CUST_NO = b.EXTVALUE101 and a.DIST_NO = b.EXTVALUE102 and a.SUB_NO = b.EXTVALUE105 and a.FUEL_TYPE = b.EXTVALUE123); update aud_member_ext_attributes b set EXTVALUE229 = (select a.R12 from gl_totals a where a.category = 'tankrent' and a.CUST_NO = b.EXTVALUE101 and a.DIST_NO = b.EXTVALUE102 and a.SUB_NO = b.EXTVALUE105 and a.FUEL_TYPE = b.EXTVALUE123); There are 3 "extvaluexxx" that are set for each "category" for a total of 9 categories. This makes a grand total of 27 update statements. Any suggestions? It would be much appreciated!!!!!