Re: Hash support for arrays

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Hash support for arrays
Дата
Msg-id 4CD02D5C02000025000371B6@gw.wicourts.gov
обсуждение исходный текст
Ответ на Re: Hash support for arrays  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> wrote:
>> There's no reason that the hash value of an integer of the same
>> size as the hash shouldn't be the integer itself, for example. 
>> It's hard to get more predictable than that, yet it works well
>> for hash lookups.
> 
> Well, no, not really.  For example, it may be that you have a hash
> table with N buckets and values that of the form N+k, 2N+k, 3N+k,
> .... and everything will collide.
That hardly seems convincing if the integer is a sequentially
assigned number, as with many ID columns; but if you want an
algorithm which will work well with numbers which might be assigned
in a pattern with a high correlation with some unpredictable number
of buckets -- sure, it won't work well without some scrambling.  For
sequentially assigned numbers, that scrambling would have a cost and
would be of no value.  I guess it depend a bit on your use case and
goals.
-Kevin


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Hash support for arrays
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Hash support for arrays