Re: digest data types?

From: Neil Conway <neilc(at)samurai(dot)com>
To: Reece Hart <reece(at)harts(dot)net>
Cc: SF PostgreSQL <sfpug(at)postgresql(dot)org>
Subject: Re: digest data types?
Date: 2007-04-13 00:34:36
Message-ID: 1176424476.6382.24.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: sfpug

On Thu, 2007-04-12 at 16:34 -0700, Reece Hart wrote:
> So, why is that? Admittedly, I haven't looked at the postgresql indexing
> code, but I assume at least for btree and hash that the values are the
> majority of the index mass for anything but trivial keys. So, my
> reasoning was that 2x storage of the underlying type leads to ~2x index
> sizes and potentially 2x more IO.

The difference between bytea and a custom UDT should be only 4 bytes, so
I wouldn't expect to see much difference in overall I/O.

> Essentially, what I'm asking is: does it make more sense
> to have a single type (eg, digest), or several size-specific types (eg,
> digest128, digest160, digest224, etc).

If you're going to go through the pain of creating a custom UDT, you'd
probably want digest-specific types to minimize the storage
requirements. But in most cases, I'd expect bytea(n) is good enough.

> Of course, *if* I do this, I'd like to do so in a kosher way that would
> enable it to get rolled into the mainline (pg_crypto?).

Modifying pgcrypto to add a new UDT would definitely be one way to go,
sure: this is probably too domain-specific for the core backend.

-Neil

In response to

Browse sfpug by date

  From Date Subject
Next Message David Fetter 2007-04-23 18:55:57 Meeting: Sourceforge Infrastructure
Previous Message Steve Atkins 2007-04-12 23:42:26 Re: digest data types?