Re: [SQL] Comparing two (largish) tables on different servers

2004-11-10 Thread Michael Fuhr
On Wed, Nov 10, 2004 at 09:18:21AM +, Sam Mason wrote: > > mkfifo db1 > psql -h "db1" -t -q -c "$query" > db1 > mkfifo db2 > psql -h "db2" -t -q -c "$query" > db2 > diff -u -0 db1 db2 This should work for small data sets, but the OP said the tables were about 5G. Unless you use a c

Re: [SQL] Comparing two (largish) tables on different servers

2004-11-10 Thread Sam Mason
Gregory S. Williamson wrote: >Is there any way to do this from inside postgres that anyone knows of >? I looked through the manual and the contrib stuff and didn't see >much ... Not really "inside postgres"; but could you do something like: mkfifo db1 psql -h "db1" -t -q -c "$query" > db1 m

Re: [SQL] Comparing two (largish) tables on different servers

2004-11-09 Thread Pierre-Frédéric Caillaud
Idea : Write a program which connects on the two databases, creates a cursor on each to return the rows in order, then compare them as they come (row 1 from cursor 1 == row 1 from cursor 2, etc). Fetch in batchs. If there's a difference you can then know which row. I hope you have an index

[SQL] Comparing two (largish) tables on different servers

2004-11-09 Thread Gregory S. Williamson
This is probably a silly question. Our runtime deployment of database servers (7.4) involves some redundant/duplicate databases. In order to compare tables (about 5 gigs each) on different servers I unload the things (takes a while etc.), sort them with a UNIX sort and then do a cksum on them.