Re: Table checksum proposal

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Table checksum proposal
Date: 2014-07-24 20:22:12
Message-ID: 20140724202212.GC3996@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 boost?
> > 3. Is there a risk of different architectures/versions returning different
> > checksums for tables which could be considered identical? If so, is this
> > worth worrying about?
> >
>
> Hmm - Do you really think we need an extension for something that can be
> done using query as simple as:
>
> select md5(string_agg(md5(c::text), '' order by md5(c::text))) from
> pg_class c;

Just a nitpick, and not really relevant to the OPs question,
but probably useful to people trying to actually use this
across potentially different locale settings: throw in a

DECODE(md5(...), 'hex')

for the ORDER BY like

select md5(string_agg(md5(c::text), '' order by decode(md5(c::text), 'hex'))) from pg_class c;

Karsten
--
GPG key ID E4071346 @ gpg-keyserver.de
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Karsten Hilbert 2014-07-24 20:28:05 Re: Table checksum proposal
Previous Message Fabio Milano 2014-07-24 20:03:42 Re: Standby Server Bus 7 error