pg.ddx.io pgsql-performance@postgresql.org mailing list archive
help / color / mirror / Atom feedIs there a way to selective dump of records in Postgres 9.0.3?
3+ messages / 3 participants
[nested] [flat]
* Is there a way to selective dump of records in Postgres 9.0.3?
@ 2011-04-18 15:05 Sethu Prasad <sethuprasad.in@gmail.com>
2011-04-18 15:11 ` Re: Is there a way to selective dump of records in Postgres 9.0.3? Nikolas Everett <nik9000@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Sethu Prasad @ 2011-04-18 15:05 UTC (permalink / raw)
To: pgsql-performance
Hi List,
I am using PostgreSQL 9.0.3 and I have a need to dump only the selective
data from partial list of tables of a database. Is there a straight way to
do it with pg_dump or any alternative work around to suggest here?!
Sethu Prasad. G.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Is there a way to selective dump of records in Postgres 9.0.3?
2011-04-18 15:05 Is there a way to selective dump of records in Postgres 9.0.3? Sethu Prasad <sethuprasad.in@gmail.com>
@ 2011-04-18 15:11 ` Nikolas Everett <nik9000@gmail.com>
2011-04-18 16:01 ` Re: Is there a way to selective dump of records in Postgres 9.0.3? Samuel Gendler <sgendler@ideasculptor.com>
0 siblings, 1 reply; 3+ messages in thread
From: Nikolas Everett @ 2011-04-18 15:11 UTC (permalink / raw)
To: Sethu Prasad <sethuprasad.in@gmail.com>; +Cc: pgsql-performance
This probably isn't the right place to ask that question but you may as well
try `pg_dump -t PATTERN`. Man pg_dump for more information on how to form
that pattern.
On Mon, Apr 18, 2011 at 11:05 AM, Sethu Prasad <sethuprasad.in@gmail.com>wrote:
> Hi List,
> I am using PostgreSQL 9.0.3 and I have a need to dump only the selective
> data from partial list of tables of a database. Is there a straight way to
> do it with pg_dump or any alternative work around to suggest here?!
>
> Sethu Prasad. G.
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Is there a way to selective dump of records in Postgres 9.0.3?
2011-04-18 15:05 Is there a way to selective dump of records in Postgres 9.0.3? Sethu Prasad <sethuprasad.in@gmail.com>
2011-04-18 15:11 ` Re: Is there a way to selective dump of records in Postgres 9.0.3? Nikolas Everett <nik9000@gmail.com>
@ 2011-04-18 16:01 ` Samuel Gendler <sgendler@ideasculptor.com>
0 siblings, 0 replies; 3+ messages in thread
From: Samuel Gendler @ 2011-04-18 16:01 UTC (permalink / raw)
To: Nikolas Everett <nik9000@gmail.com>; +Cc: Sethu Prasad <sethuprasad.in@gmail.com>; pgsql-performance
On Mon, Apr 18, 2011 at 8:11 AM, Nikolas Everett <nik9000@gmail.com> wrote:
> This probably isn't the right place to ask that question but you may as
> well try `pg_dump -t PATTERN`. Man pg_dump for more information on how to
> form that pattern.
>
>
> On Mon, Apr 18, 2011 at 11:05 AM, Sethu Prasad <sethuprasad.in@gmail.com>wrote:
>
>> Hi List,
>> I am using PostgreSQL 9.0.3 and I have a need to dump only the selective
>> data from partial list of tables of a database. Is there a straight way to
>> do it with pg_dump or any alternative work around to suggest here?!
>>
>
Or if you need partial data from one table - a WHERE clause - then you can
do:
COPY (select * from whatever where column=value) TO '/tmp/dump.csv' WITH CSV
HEADER
in combination with
pg_dump -f whatever.sql -s -t whatever db
to dump the DDL for the 'whatever' table into whatever.sql.
http://www.postgresql.org/docs/current/static/sql-copy.html
If it is a lot of data, you'll want to edit the whatever.sql file to remove
the CREATE INDEX statements until after you've loaded the table and then
depeneding upon how many indexes there are and how many rows you havem you
may want to parallelize the CREATE INDEX statements by running them in
parallel in multiple psql sessions (and possibly with an artificially large
maintenance_work_mem if that speeds things up)
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2011-04-18 16:01 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-18 15:05 Is there a way to selective dump of records in Postgres 9.0.3? Sethu Prasad <sethuprasad.in@gmail.com>
2011-04-18 15:11 ` Nikolas Everett <nik9000@gmail.com>
2011-04-18 16:01 ` Samuel Gendler <sgendler@ideasculptor.com>
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