Re: Creating large database of MD5 hash values - Mailing list pgsql-performance

From Florian Weimer
Subject Re: Creating large database of MD5 hash values
Date
Msg-id 82k5j4sd0z.fsf@mid.bfk.de
Whole thread Raw
In response to Creating large database of MD5 hash values  ("Jon Stewart" <jonathan.l.stewart@gmail.com>)
Responses Re: Creating large database of MD5 hash values
List pgsql-performance
* Jon Stewart:

> 1. Which datatype should I use to represent the hash value? UUIDs are
> also 16 bytes...

BYTEA is slower to load and a bit inconvenient to use from DBI, but
occupies less space on disk than TEXT or VARCHAR in hex form (17 vs 33
bytes with PostgreSQL 8.3).

> 2. Does it make sense to denormalize the hash set relationships?

That depends entirely on your application.

> 3. Should I index?

Depends.  B-tree is generally faster than Hash, even for randomly
distributed keys (like the output of a hash function).

> 4. What other data structure options would it make sense for me to
> choose?

See 2.

In general, hashing is bad because it destroy locality.  But in some
cases, there is no other choice.

--
Florian Weimer                <fweimer@bfk.de>
BFK edv-consulting GmbH       http://www.bfk.de/
Kriegsstraße 100              tel: +49-721-96201-1
D-76133 Karlsruhe             fax: +49-721-96201-99

pgsql-performance by date:

Previous
From: Chris
Date:
Subject: Re: Creating large database of MD5 hash values
Next
From: Alvaro Herrera
Date:
Subject: Re: Creating large database of MD5 hash values