[SQL] pg_restore
Hi all, I have two databases db1 and db2 with no network connection. I want to take backup of few master tables from db1 and restore it to db2 at frequent intervals.. I do not want to delete data from the tables and restores the fresh data as this data is getting referenced in other tables. I can do that by creating scripts on db1 and executing the same on db2. But I want to know if I can use pg_restore command to overwrite existing data of these master tables Thanks, Jyoti
[SQL] backup
Hi all, Can we take backup of specific data of a table (using where clause)? Thanks, Jyoti
Re: [SQL] backup
Jyoti Seth wrote: Hi all, Can we take backup of specific data of a table (using where clause)? Thanks, Jyoti Try Selective COPY With Regards Ashish Karalkar EnterpriseDB -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] backup
On 2009-06-09, Jyoti Seth wrote: > This is a multipart message in MIME format. > > --=_NextPart_000_003C_01C9E916.43A8D460 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > Hi all, > > > > Can we take backup of specific data of a table (using where clause)? in psql: /copy (select * from table WHERE condition ) to 'FILENAME' requires postgres version >= 8.2 IIRC. you can use any query. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
[SQL] Taking the cache out of the equation?
Caching helps a *lot* and I'm thankful for that but I would like to take it out of the picture as I massage my queries for better performance. Naturally the first invocation of the query cannot take advantage of the cache and these queries would normally only be called once for the same target data.What tricks are there to flush, ignore, circumvent the caching boost? (Especially in the production environment.) -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] backup
I tried using /copy command. It is not giving any error but also not creating any file. Thanks Jyoti -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Jasen Betts Sent: Tuesday, June 09, 2009 6:03 PM To: [email protected] Subject: Re: [SQL] backup On 2009-06-09, Jyoti Seth wrote: > This is a multipart message in MIME format. > > --=_NextPart_000_003C_01C9E916.43A8D460 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > Hi all, > > > > Can we take backup of specific data of a table (using where clause)? in psql: /copy (select * from table WHERE condition ) to 'FILENAME' requires postgres version >= 8.2 IIRC. you can use any query. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] backup
It should be \copy . This is a psql command; if you have direct access to database host machine, you might want to use the SQL command COPY for it's performance. http://www.postgresql.org/docs/8.3/interactive/app-psql.html http://www.postgresql.org/docs/8.3/interactive/sql-copy.html Best regards, On Wed, Jun 10, 2009 at 10:38 AM, Jyoti Seth wrote: > I tried using /copy command. It is not giving any error but also not > creating any file. > > Thanks > Jyoti > > -Original Message- > From: [email protected] [mailto: > [email protected]] > On Behalf Of Jasen Betts > Sent: Tuesday, June 09, 2009 6:03 PM > To: [email protected] > Subject: Re: [SQL] backup > > On 2009-06-09, Jyoti Seth wrote: > > This is a multipart message in MIME format. > > > > --=_NextPart_000_003C_01C9E916.43A8D460 > > Content-Type: text/plain; > > charset="us-ascii" > > Content-Transfer-Encoding: 7bit > > > > Hi all, > > > > > > > > Can we take backup of specific data of a table (using where clause)? > > in psql: > > /copy (select * from table WHERE condition ) to 'FILENAME' > > requires postgres version >= 8.2 IIRC. > > you can use any query. > > -- > Sent via pgsql-sql mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > > > -- > Sent via pgsql-sql mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > -- Lets call it Postgres EnterpriseDB http://www.enterprisedb.com gurjeet[[email protected] singh.gurj...@{ gmail | hotmail | indiatimes | yahoo }.com Mail sent from my BlackLaptop device
Re: [SQL] backup
Thanks it worked when I changed the command '/copy' to '\copy' -Original Message- From: [email protected] [mailto:[email protected]] On Behalf Of Jasen Betts Sent: Tuesday, June 09, 2009 6:03 PM To: [email protected] Subject: Re: [SQL] backup On 2009-06-09, Jyoti Seth wrote: > This is a multipart message in MIME format. > > --=_NextPart_000_003C_01C9E916.43A8D460 > Content-Type: text/plain; > charset="us-ascii" > Content-Transfer-Encoding: 7bit > > Hi all, > > > > Can we take backup of specific data of a table (using where clause)? in psql: /copy (select * from table WHERE condition ) to 'FILENAME' requires postgres version >= 8.2 IIRC. you can use any query. -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql -- Sent via pgsql-sql mailing list ([email protected]) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql
Re: [SQL] backup
On Wed, Jun 10, 2009 at 10:38 AM, Jyoti Seth wrote: > I tried using /copy command. It is not giving any error but also not > creating any file. > Thanks > Jyoti Use copy command as follows if the OS is Linux, postgres=# copy (select * from test where setid>20) to '/var/tmp/t2.dmp'; COPY 3 postgres=# \q -bash-3.1$ cat /var/tmp/t2.dmp 123422 1 2009-01-08 00:00:00 dup1-2 987621 1 2009-01-10 00:00:00 dup2-1 1 21 1 2009-01-10 00:00:00 dup2-1 If it is Windows, use can use as, postgres=# copy (select *from test where a<6) to 'C:/Program Files/PostgreSQL/8.3/data/samp.sql'; COPY 9 Thanks, Abbas EnterpriseDB > > -Original Message- > From: [email protected] [mailto: > [email protected]] > On Behalf Of Jasen Betts > Sent: Tuesday, June 09, 2009 6:03 PM > To: [email protected] > Subject: Re: [SQL] backup > > On 2009-06-09, Jyoti Seth wrote: > > This is a multipart message in MIME format. > > > > --=_NextPart_000_003C_01C9E916.43A8D460 > > Content-Type: text/plain; > > charset="us-ascii" > > Content-Transfer-Encoding: 7bit > > > > Hi all, > > > > > > > > Can we take backup of specific data of a table (using where clause)? > > in psql: > > /copy (select * from table WHERE condition ) to 'FILENAME' > > requires postgres version >= 8.2 IIRC. > > you can use any query. > > -- > Sent via pgsql-sql mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql > > > -- > Sent via pgsql-sql mailing list ([email protected]) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-sql >
