[GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
Hi all, I am trying to backup a large table with about 6 million rows. I want to export the data from the table and be able to import it into another table on a different database server (from pgsql 8.1 to 8.2). I need to export the data through SQL query 'cause I want to do a gradual backup.

Re: [GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
CAJ CAJ wrote: Have you looked at pg_dump -t http://www.postgresql.org/docs/8.2/static/app-pgdump.html Joey Thanks for quick response but pg_dump does not allow me to dump from a SQL SELECT query which is what I wanna do. -- View this message in context:

Re: [GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
Thanks all. The COPY command seems to do the work. One more thing, say I want the data dumped on a remote machine rather than on the current machine, how would I do that without having to first dump it on the local machine then uploading to the remote machine? -- View this message in context:

Re: [GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
If I wanted to use that with a command like COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO 'filename'; do I specify the file location for the remote machine as the filename or do I specify the location for local machine? And what if the psql clients are different (local: 8.1.5

Re: [GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
Local file systems, and the user postgres needs write-access. I'm using /tmp/... for such. And yes: COPY from a select works only for 8.2 up, not for 8.1. Create a table via 'create table as select ...' and COPY this table. I'm trying to avoid exporting to the local machine before

Re: [GENERAL] Need help on how to backup a table

2008-03-28 Thread ajcity
ashish-21 wrote: ajcity wrote: If I wanted to use that with a command like COPY (SELECT * FROM country WHERE country_name LIKE 'A%') TO 'filename'; do I specify the file location for the remote machine as the filename or do I specify the location for local machine? And what