From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | anj patnaik <patna73(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: how to create dump of selected rows from a table |
Date: | 2015-12-18 15:30:23 |
Message-ID: | CANu8FixEKZr8jeVJGB_ChQXWr0hp_65-VLhKRHbiG2_ctPjSOw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
And to get the structure of a table, you can use
pg_describe_object(catalog_id, object_id, object_sub_id)
On Fri, Dec 18, 2015 at 10:16 AM, Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 12/17/2015 09:28 AM, anj patnaik wrote:
>
>> Currently, I am running pg_dump on an entire table of a database by doing:
>>
>> PGPASSWORD=$PGPASSWORDB /opt/data/PostgreSQL/9.4/bin/pg_dump -t
>> RECORDER -Fc $i -U pguser -Z0 | xz -9 >
>> "$backup_dir/$i-$timeslot-database"
>>
>> However, this table has a lot of rows.
>>
>> Is there a way I could do pg_dump on a subset of rows that match a
>> criteria say via a sql statement?
>>
>
> Yes it is called COPY:):
>
> http://www.postgresql.org/docs/9.4/interactive/sql-copy.html
>
> or its psql equivalent \copy:
>
> http://www.postgresql.org/docs/9.4/interactive/app-psql.html
>
>
>
>> Does anyone have any snippets on how to do that?
>>
>> Thank you
>>
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
--
*Melvin Davidson*
I reserve the right to fantasize. Whether or not you
wish to share my fantasy is entirely up to you.
From | Date | Subject | |
---|---|---|---|
Next Message | Karl Czajkowski | 2015-12-18 16:32:52 | Re: Check old and new tuple in row-level policy? |
Previous Message | Adrian Klaver | 2015-12-18 15:16:55 | Re: how to create dump of selected rows from a table |