Re: Is there an md5sum for tables?

From: btober(at)ct(dot)metrocast(dot)net
To: Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is there an md5sum for tables?
Date: 2008-04-02 12:18:13
Message-ID: 47F37985.7010008@ct.metrocast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Michael Enke wrote:
> I need to know if multiple tables have (may have most probably)
> identical content.
> Since I want a fast solution (which means not comparing tables row by row),
> I thought it would be a good idea to have an sql function operating on a
> table or view
> similar to md5sum on a file and only compare the generated hashes.
> I did not find such a function in the documentation.
>
> Is such a function already available?

I think what I would do is develop a shell script that ran select
queries (with an "order by" clause, of course) against the tables, then
compare the output the result sets using diff.

If you need to monitor for differences over time, like to catch changes,
then drive that script with cron and have it generate an email warning
message when diff notices that the output are no longer identical.

-- BMT

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Albe Laurenz 2008-04-02 12:18:25 Re: Foreign keys causing conflicts leading toserialization failures
Previous Message Peter Schuller 2008-04-02 11:56:31 Re: Foreign keys causing conflicts leading to serialization failures