Re: Hash function for numeric (WIP)

From: Neil Conway <neilc(at)samurai(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Hash function for numeric (WIP)
Date: 2007-05-07 01:23:05
Message-ID: 1178500985.18303.170.camel@goldbach
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

On Thu, 2007-03-05 at 23:57 -0400, Tom Lane wrote:
> Hm, but apply hash_any() to the remaining digits? That might work, if
> you are careful about how you factor the weight into it (or just not try
> to use the weight in the hash).

Attached is a patch that implements this idea. Since leading or trailing
zeroes are far from the common case, I think we should still include the
weight in the hash when possible: the patch does so when it doesn't find
a leading zero in the Numeric. I did some testing by constructing an
in-memory Numeric with leading and trailing zeroes, and this approach
seems to work.

Unless you see anything else that needs fixing, I'll apply this patch to
HEAD in a day or two.

-Neil

Attachment Content-Type Size
numeric_hash_func-6.patch text/x-patch 9.1 KB

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-05-07 01:30:14 Re: Hash function for numeric (WIP)
Previous Message Tom Lane 2007-05-07 01:11:55 Re: Enable integer datetimes by default