Tuesday, March 11, 2008

Things I'm impressed by pipe

When I dump DB data I usually do this way.
pg_dump -U postgres foo > dump.sql
Or
pg_dump -U postgres foo | gzip > dump.sql.gz

Then restore it from file. (Uncompress the file if you compressed the dump data)
psql -U postgres bar < dump.sql

But, if you use pipe, you don't need to dump it to a file.
Just send stream to a new DB!!
pg_dump -U postgres foo | psql -U postgres bar

It looks not so impressive. But, let's think two databases are located on each separated servers.
you can do this.
pg_dump -U postgres -h 192.168.0.1 foo | psql -U postgres -h 192.168.0.2 bar


Oh pipe! Thank god!! Thank person who made pipe!!! :-)
(weight 89.2kg BMI 30%)

Labels:

2 Comments:

At 1:26 AM, Blogger komagata said...

Oh my god!

 
At 9:46 AM, Blogger kawadu said...

hahah! I feel happy you are still alive!! yes oh my god!

 

Post a Comment

<< Home