pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rod Taylor <pg@rbt.ca>
To: Rosser Schwarz <rschwarz@totalcardinc.com>
Cc: Postgresql Performance <pgsql-performance@postgresql.org>
Subject: Re: atrocious update performance
Date: Mon, 15 Mar 2004 16:54:35 -0500
Message-ID: <1079387674.33643.12.camel@jester> (raw)
In-Reply-To: <001501c40ad2$b3f7ade0$2500fa0a@CardServices.TCI.com>
References: <001501c40ad2$b3f7ade0$2500fa0a@CardServices.TCI.com>

On Mon, 2004-03-15 at 16:15, Rosser Schwarz wrote:
> > > # explain update account.cust set prodid = tempprod.prodid
> > > 	where tempprod.did = origid;
> 
> > >  Merge Join  (cost=0.00..232764.69 rows=4731410 width=252)
> > >    Merge Cond: (("outer".origid)::text = ("inner".did)::text)
> > >    ->  Index Scan using ix_origid on cust  (cost=0.00..94876.83
> > >        rows=4731410 width=244)
> > >    ->  Index Scan using ix_did on tempprod  (cost=0.00..66916.71
> > >        rows=4731410 width=18)
>  
> > I'm going to hazard a guess and say you have a number of foreign keys
> > that refer to account.cust.prodid? This is probably the time consuming
> > part -- perhaps even a missing index on one of those keys 
> > that refers to
> > this field.
> 
> Actually, there are no foreign keys to those columns.  Once they're
> populated, I'll apply a foreign key constraint and they'll refer to the
> appropriate row in the prod and subprod tables, but nothing will 
> reference account.cust.[sub]prodid.  There are, of course, several foreign
> keys referencing account.cust.custid.

If there are no feign keys to it, I wouldn't expect it to take more than
10 minutes on slow hardware.

Fresh out of ideas here.





view thread (39+ messages)  latest in thread

Message-ID: <1079387674.33643.12.camel@jester>
Permalink:  ../1079387674.33643.12.camel@jester/
Also on:    postgresql.org/message-id/1079387674.33643.12.camel@jester

 · 

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-performance@postgresql.org
  Cc: pg@rbt.ca, rschwarz@totalcardinc.com
  Subject: Re: atrocious update performance
  In-Reply-To: <1079387674.33643.12.camel@jester>

* 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