Re: [GENERAL] Table checksum proposal

2014-07-24 Thread hubert depesz lubaczewski
On Thu, Jul 24, 2014 at 3:35 AM, m...@byrney.com wrote: I have a suggestion for a table checksumming facility within PostgreSQL. The applications are reasonably obvious - detecting changes to tables, validating data migrations, unit testing etc. A possible algorithm is as follows: 1. For

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread matt
On Thu, Jul 24, 2014 at 3:35 AM, m...@byrney.com wrote: I have a suggestion for a table checksumming facility within PostgreSQL. The applications are reasonably obvious - detecting changes to tables, validating data migrations, unit testing etc. A possible algorithm is as follows: 1. For

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread Karsten Hilbert
On Thu, Jul 24, 2014 at 01:43:29PM +0200, hubert depesz lubaczewski wrote: 1. Should this be a contrib module which provides a function, or should it be a built-in piece of functionality? 2. Is MD5 too heavyweight for this? Would using a non-cryptographic checksum be worth the speed

Re: [GENERAL] Table checksum proposal

2014-07-24 Thread Karsten Hilbert
On Thu, Jul 24, 2014 at 03:06:28PM +0100, m...@byrney.com wrote: select md5(string_agg(md5(c::text), '' order by md5(c::text))) from pg_class c; (of course you can do it on any table, not only pg_class). If you want to use the xor idea (which make sense), all you need is to write

[GENERAL] Table checksum proposal

2014-07-23 Thread matt
I have a suggestion for a table checksumming facility within PostgreSQL. The applications are reasonably obvious - detecting changes to tables, validating data migrations, unit testing etc. A possible algorithm is as follows: 1. For each row of the table, take the binary representations of the