From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: ow <oneway_111@yahoo.com>
Cc: Jeff <threshar@torgo.978.org>
Cc: pgsql-admin@postgresql.org
Subject: Re: pg_restore and FK constraints with large dbs
Date: Mon, 17 Nov 2003 13:10:27 -0800 (PST)
Message-ID: <20031117130034.M3748@megazone.bigpanda.com> (raw)
In-Reply-To: <20031117203824.18689.qmail@web21401.mail.yahoo.com>
References: <20031117203824.18689.qmail@web21401.mail.yahoo.com>
On Mon, 17 Nov 2003, ow wrote:
> --- Jeff <threshar@torgo.978.org> wrote:
> > On Mon, 17 Nov 2003 10:40:20 -0800 (PST)
> > Stephan Szabo <sszabo@megazone.bigpanda.com> wrote:
> >
> > >
> > > By the way, what does your schema look like? I created an 80M row fk
> > > table and 20K row pk table with an int4 key between them and indexes on
> > > the two key fields. It took about 25 minutes on my not terribly fast
> > > system using 7.4b5 to make the foreign key between them. It might have
> > > been faster if I'd raised sort_mem to something larger than 8192.
> > >
>
> PK and FK keys are of "Dkey" domain, "Dkey" domain is mapped to INT4. There's
> PK index on 20K pk table, *NO* index on the fk field on 80M fk table. Why no
> index on the fk field? Several reasons: (1) app logic does not call for
> accessing fk table based solely on the fk (2) fk field is a part of multi-field
> AK index (3) unnecessary indexes take space and slow down inserts/updates,
> which is a factor for large tables.
I assume you're also not modifying the pktable rows (since that would
access the fk table based solely on the fk). Does the multi-field index
start with fk or some other field? Hmm, the changes in 7.4 for alter
probably don't help as much without an index (it saves the cost of making
all those executors, but that's might be it). Doing, schema, turning off
triggers on the table, data might have worked in general, but if you've
got a textual combined dump that'd be a mess for a workaround (it might be
reasonable in pg_restore, but I don't tend to use it, so I couldn't say)
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-admin@postgresql.org
Cc: sszabo@megazone.bigpanda.com, oneway_111@yahoo.com, threshar@torgo.978.org
Subject: Re: pg_restore and FK constraints with large dbs
In-Reply-To: <20031117130034.M3748@megazone.bigpanda.com>
References: <20031117203824.18689.qmail@web21401.mail.yahoo.com> <20031117130034.M3748@megazone.bigpanda.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