Preferred usage for 'copy to' for a subset of data

From: "Jason L(dot) Buberel" <jason(at)buberel(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Preferred usage for 'copy to' for a subset of data
Date: 2007-09-14 04:50:03
Message-ID: 46EA12FB.8080507@buberel.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

For recent postgres releases, is there any effective difference
(performance/memory/io) between:

create temp table foo as select * from bar where bar.date > '2007-01-01';
copy foo to '/tmp/bar.out';
drop table temp;

and this:

copy ( select * from bar where bar.date > '2007-01-01' ) to '/tmp/bar.out';

...that would lead me to use one method vs. the other on large data sets
(1M+ records)?

Just wondering,
Jason

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2007-09-14 05:01:46 Re: Preferred usage for 'copy to' for a subset of data
Previous Message Bruce Momjian 2007-09-14 04:19:38 Re: FATAL: could not reattach to shared memory (Win32)