pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jie Liang <jliang@ipinc.com>
To: Webb Sprague <wsprague100@yahoo.com>
Cc: Stephan Szabo <sszabo@megazone23.bigpanda.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Optimizing huge inserts/copy's
Date: Wed, 30 Aug 2000 12:20:05 -0700
Message-ID: <39AD5E65.E79C06F1@ipinc.com> (raw)
References: <20000830185717.12822.qmail@web803.mail.yahoo.com>

Hi,

I knew that if no constarint, it populate very quick, my question is:
when two tables have been
reloaded, then I want to add a foreign key constraint to it, say:
tableA has primary key column (id)
tableB has a column (id) references it, so I say:
ALTER TABLE tableB ADD CONSTRAINT distfk FOREIGN KEY (id) REFERENCES
tableA(id)  ON DELETE CASCADE ;

It just seems takes forever.

Thanks anyway.


Webb Sprague wrote:

> I am experimenting with this too.  If I have any
> indexes at all, the copy's get VERY SLOW as the table
> gets big.  Delete ALL your indexes, do your copy's,
> and then create your indexes again.
>
> Good luck.
> --- Jie Liang <jliang@ipinc.com> wrote:
> > Hi, there,
> >
> > I tried different  ways,  include vaccum table ,
> > ensure index works, it
> > still is as slow as ~100rows per minute.
> >
> >
> > Stephan Szabo wrote:
> >
> > > On Tue, 29 Aug 2000, Jie Liang wrote:
> > >
> > > > Hi, there,
> > > >
> > > > 1. use copy ... from '.....';
> > > > 2. write a PL/pgSQL function and pass multiple
> > records as an array.
> > > >
> > > > However, if your table have a foreign key
> > constraint, it cannot be speed
> > > > up,
> > > >
> > > > I have same question as you, my table invloving
> > 9-13 million rows, I
> > > > don't
> > > > know how can I add a foreign key them also?
> > >
> > > I haven't tried it on really large tables, but
> > does it turn out faster to
> > > use ALTER TABLE ADD CONSTRAINT to add the foreign
> > key constraint after the
> > > data is loaded and the indexes are created?
> >
> > --
> > Jie LIANG
> >
> > Internet Products Inc.
> >
> > 10350 Science Center Drive
> > Suite 100, San Diego, CA 92121
> > Office:(858)320-4873
> >
> > jliang@ipinc.com
> > www.ipinc.com
> >
> >
> >
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/

--
Jie LIANG

Internet Products Inc.

10350 Science Center Drive
Suite 100, San Diego, CA 92121
Office:(858)320-4873

jliang@ipinc.com
www.ipinc.com






view thread (9+ messages)  latest in thread

Message-ID: <39AD5E65.E79C06F1@ipinc.com>
Permalink:  ../39AD5E65.E79C06F1@ipinc.com/
Also on:    postgresql.org/message-id/39AD5E65.E79C06F1@ipinc.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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: jliang@ipinc.com, wsprague100@yahoo.com, sszabo@megazone23.bigpanda.com
  Subject: Re: Optimizing huge inserts/copy's
  In-Reply-To: <39AD5E65.E79C06F1@ipinc.com>
  References: <20000830185717.12822.qmail@web803.mail.yahoo.com> <39AD5E65.E79C06F1@ipinc.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