Re: hash options - Mailing list pgsql-general

From Chris Angelico
Subject Re: hash options
Date
Msg-id CAPTjJmpSZMux+i5AuLheyJ0d_7po+__2EpHAv6XBTvE5P=DChQ@mail.gmail.com
Whole thread Raw
In response to hash options  ("Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>)
List pgsql-general
On Mon, Jan 23, 2012 at 2:59 AM, Little, Douglas
<DOUGLAS.LITTLE@orbitz.com> wrote:
>
> I’ve implemented with MD5.  It works fine,  the problem I have is the size of the md5 (32 bytes) is often longer than
theoriginal string – thus not accomplishing what I want – space savings. 

You can always use a truncated hash - for instance, take the first 6-8
hex digits of the MD5 or SHA1 hash. For human readability, that's
likely to be all you need (for instance, git references commits by
their SHA1 hashes, but you can work with just the first six digits
quite happily). Otherwise, can you provide more details on why you
need a hash, and why it wants to be shorter than the original?

Chris Angelico

pgsql-general by date:

Previous
From: "Little, Douglas"
Date:
Subject: hash options
Next
From: Tom Lane
Date:
Subject: Re: Database takes up MUCH more disk space than it should