Re: Why hash OIDs?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Why hash OIDs?
Дата
Msg-id 19810.1535423204@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Why hash OIDs?  (Andres Freund <andres@anarazel.de>)
Ответы Re: Why hash OIDs?
Список pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> On 2018-08-28 13:50:43 +1200, Thomas Munro wrote:
>> What bad thing would happen if we used OIDs directly as hash values in
>> internal hash tables (that is, instead of uint32_hash() we'd use
>> uint32_identity(), or somehow optimise it away entirely, as you can
>> see in some C++ standard libraries for eg std::hash<int>)?

> Oids are very much not equally distributed, so in all likelihood you'd
> get cases very you currently have a reasonably well averaged out usage
> of the hashtable, not be that anymore.

Right.  In particular, most of our hash usages assume that all bits of
the hash value are equally "random", so that we can just mask off the
lowest N bits of the hash and not get values that are biased towards
particular hash buckets.  It's unlikely that raw OIDs would have that
property.

            regards, tom lane


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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Why hash OIDs?
Следующее
От: Michael Paquier
Дата:
Сообщение: Re: Postmaster doesn't send SIGTERM to bgworker during fast shutdownwhen pmState == PM_STARTUP