From: | Volkan YAZICI <yazicivo(at)ttmail(dot)com> |
---|---|
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 08:31:16 |
Message-ID: | 87fxu4y7xn.fsf@alamut.mobiliz.com.tr |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Michael Enke <michael(dot)enke(at)wincor-nixdorf(dot)com> writes:
> I need to know if multiple tables have (may have most probably)
> identical content.
That sounds me you should re-consider your database design. Having PK/FK
relations is the reason we divide common parts into separate tables to
avoid from data duplication.
> 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.
First alter related tables and prepend a hash field to each one. After
that, you can implement your own PL/pgSQL procedure which takes a table
name and queries supplied table's columns from information_schema and
builds an SQL query string to concatenate MD5 hash of available table
fields into a single field, and updates hash field of each field
according to computed hash.
Regards.
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Smith | 2008-04-02 08:32:42 | Re: simple update queries take a long time - postgres 8.3.1 |
Previous Message | Greg Smith | 2008-04-02 08:19:23 | Re: simple update queries take a long time - postgres 8.3.1 |