pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: iu_23@hotmail.com
To: pgsql-sql@postgresql.org
Subject: multiple sql update w/ major time issues
Date: 6 Jun 2001 08:23:21 -0700
Message-ID: <aaac9c0b.0106060723.57cfa53a@posting.google.com> (raw)

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!!!!!



view thread (3+ messages)  latest in thread

Message-ID: <aaac9c0b.0106060723.57cfa53a@posting.google.com>
Permalink:  ../aaac9c0b.0106060723.57cfa53a@posting.google.com/
Also on:    postgresql.org/message-id/aaac9c0b.0106060723.57cfa53a@posting.google.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: iu_23@hotmail.com
  Subject: Re: multiple sql update w/ major time issues
  In-Reply-To: <aaac9c0b.0106060723.57cfa53a@posting.google.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox