Re: Hash function for numeric (WIP)
От | Tom Lane |
---|---|
Тема | Re: Hash function for numeric (WIP) |
Дата | |
Msg-id | 18762.1178501414@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: Hash function for numeric (WIP) (Neil Conway <neilc@samurai.com>) |
Ответы |
Re: Hash function for numeric (WIP)
Re: Hash function for numeric (WIP) |
Список | pgsql-patches |
Neil Conway <neilc@samurai.com> 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
В списке pgsql-patches по дате отправления: