Neil Conway <[EMAIL PROTECTED]> writes:
> 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.

You can do it always if you simply decrement the weight for each leading
zero removed.  (Of course, if you end up with no nonzero digits, you
need to return a fixed hashcode such as 0, regardless of weight.  The
patch as given is wrong since it makes the test for no-digits before
instead of after removing zeroes.)

It'd be a good idea if you repeat the previous number-of-collisions
experiment on this code.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Reply via email to