Search Postgresql Archives

Re: Is there an md5sum for tables?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Enke <michael.enke@xxxxxxxxxxxxxxxxxx> 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.

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux