Re: Random resultset retrieving -> performance bottleneck - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: Random resultset retrieving -> performance bottleneck
Date
Msg-id 20020802070832.Y39893-100000@megazone23.bigpanda.com
Whole thread Raw
In response to Random resultset retrieving -> performance bottleneck  (Cédric Dufour <cedric.dufour@freesurf.ch>)
List pgsql-sql
On Thu, 1 Aug 2002, [iso-8859-1] C�dric Dufour wrote:

> *****
> * 2.
> *****
> BEGIN;
> SET CONSTRAINTS ALL DEFERRED;
> CREATE TEMP TABLE tmp_Large AS SELECT * FROM tb_Table;
> DELETE FROM tb_Large; -- won't work; RI violation on foreign key
> 'tb_Foo(FK_Large)'
> INSERT INTO tb_Large SELECT * FROM tb_Table ORDER BY Random;
> DROP TABLE tmp_Large;
> COMMIT;
>
> -> Would preserve oids, constraints and indexes... BUT DELETE IS IMPOSSIBLE,
> BECAUSE REFERENTIAL INTEGRITY IS VIOLATED ON FOREIGN KEY 'FK_Large' IN TABLE
> 'tb_Foo', despite the SET CONSTRAINTS ALL DEFERRED clause

Yeah, there's been a bug that should now be patched for upcoming 7.3
that caused this to fail.  I believe you should be able to find the
patch if you search -patches since it was pretty recent.  It might take a
little work to patch to a previous version, but it shouldn't be too hard.

Failing that, you can turn off all triggers (look at the output of
a data only pg_dump for queries to turn off/on trigger).



pgsql-sql by date:

Previous
From: Cédric Dufour (Cogito Ergo Soft)
Date:
Subject: Re: How to optimize SQL query ?
Next
From: "Rajesh Kumar Mallah."
Date:
Subject: possible bug in \df+