Re: Is there an md5sum for tables?
От | Volkan YAZICI |
---|---|
Тема | Re: Is there an md5sum for tables? |
Дата | |
Msg-id | 87fxu4y7xn.fsf@alamut.mobiliz.com.tr обсуждение исходный текст |
Ответ на | Is there an md5sum for tables? (Michael Enke <michael.enke@wincor-nixdorf.com>) |
Список | pgsql-general |
Michael Enke <michael.enke@wincor-nixdorf.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.
В списке pgsql-general по дате отправления: