pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Creager, Robert S <CreagRS@LOUISVILLE.STORTEK.COM>
To: 'Stephan Szabo' <sszabo@megazone23.bigpanda.com>
To: Josh Berkus <josh@agliodbs.com>
Cc: sqllist <pgsql-sql@postgresql.org>
Subject: RE: cannot get CREATE TABLE AS to work
Date: Fri, 9 Mar 2001 13:59:22 -0700
Message-ID: <10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.com> (raw)


Well, that explains why I wasn't seeing any appreciable speed increase with
the INITIALLY DEFERRED.  I tried mucking in pg_class, and saw a 3 fold
increase in insert speed on inserts into my table with 2 relational
triggers.  SET CONSTRAINTS ALL DEFERRED does nothing to very little to
increase the insertion speed.  15min 'INITIALLY DEFERRED' vs 13min 'ALL
DEFERRED' vs 5min 'pg_class update'.  And that 15 vs 13 could be machine
activity.

I'll appologize to anyone trying to follow this one sided converstion, as I
wasn't paying attention to the e-mail headers and though Josh was replying
to me only.

Cheers,
Rob

> -----Original Message-----
> 
> Well, you can always add deferrable initially immediate to 
> the constraint
> and run a SET CONSTRAINTS ALL DEFERRED, but I'm not sure 
> that'll actually
> be much faster, it still does a check per row I believe.
> 
> It's hacky, but I'd say, if you don't have other triggers you 
> care about, 
> twiddle pg_class.reltriggers for the class to 0, do the insert, set it
> back to what it was before and then run selects to make sure 
> the data is
> valid (ie, would the constraint have failed).
> 
> [
> assuming one column, something like:
> 
> select * from fktable where not exists
>  (select * from pktable where pktable.pkcol=fktable.fkcol);
> ]
> 



view thread (10+ messages)  latest in thread

Message-ID: <10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.com>
Permalink:  ../10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.com/
Also on:    postgresql.org/message-id/10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.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: CreagRS@LOUISVILLE.STORTEK.COM, sszabo@megazone23.bigpanda.com, josh@agliodbs.com
  Subject: Re: cannot get CREATE TABLE AS to work
  In-Reply-To: <10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.com>
  References: <10FE17AD5F7ED31188CE002048406DE8514CED@lsv-msg06.stortek.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