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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jason L(dot) Buberel" <jason(at)buberel(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Preferred usage for 'copy to' for a subset of data
Date: 2007-09-14 05:01:46
Message-ID: 21873.1189746106@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jason L. Buberel" <jason(at)buberel(dot)org> writes:
> 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';

Surely the latter will be faster, since it doesn't bother to store all
the data in a server temp table.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Dunstan 2007-09-14 07:18:12 Re: [GENERAL] ascii() for utf8
Previous Message Jason L. Buberel 2007-09-14 04:50:03 Preferred usage for 'copy to' for a subset of data