pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Weimer <fweimer@bfk.de>
To: Jon Stewart <jonathan.l.stewart@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Creating large database of MD5 hash values
Date: Fri, 11 Apr 2008 16:05:00 +0200
Message-ID: <82k5j4sd0z.fsf@mid.bfk.de> (raw)
In-Reply-To: <c0787d8a0804100748l51b63c7fx34db59e33f13c208@mail.gmail.com>
References: <c0787d8a0804100748l51b63c7fx34db59e33f13c208@mail.gmail.com>

* 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



view thread (9+ messages)  latest in thread

Message-ID: <82k5j4sd0z.fsf@mid.bfk.de>
Permalink:  ../82k5j4sd0z.fsf@mid.bfk.de/
Also on:    postgresql.org/message-id/82k5j4sd0z.fsf@mid.bfk.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: fweimer@bfk.de, jonathan.l.stewart@gmail.com
  Subject: Re: Creating large database of MD5 hash values
  In-Reply-To: <82k5j4sd0z.fsf@mid.bfk.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox