Re: Hash function for numeric (WIP) - Mailing list pgsql-patches

From Neil Conway
Subject Re: Hash function for numeric (WIP)
Date
Msg-id 1178500985.18303.170.camel@goldbach
Whole thread Raw
In response to Re: Hash function for numeric (WIP)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Hash function for numeric (WIP)
List 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

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Enable integer datetimes by default
Next
From: Tom Lane
Date:
Subject: Re: Hash function for numeric (WIP)