From: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
---|---|
To: | Cédric Dufour <cedric(dot)dufour(at)freesurf(dot)ch> |
Cc: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Random resultset retrieving -> performance bottleneck |
Date: | 2002-08-02 14:12:13 |
Message-ID: | 20020802070832.Y39893-100000@megazone23.bigpanda.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Thu, 1 Aug 2002, [iso-8859-1] Cdric 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).
From | Date | Subject | |
---|---|---|---|
Next Message | Rajesh Kumar Mallah. | 2002-08-02 14:17:28 | possible bug in \df+ |
Previous Message | Cédric Dufour (Cogito Ergo Soft) | 2002-08-02 14:06:40 | Re: How to optimize SQL query ? |