Re: Combining hash values
От | Robert Haas |
---|---|
Тема | Re: Combining hash values |
Дата | |
Msg-id | CA+TgmoZuM+h5o7qYHdoqmWxmw54nVOdm21CqeGnKKMYbtoj6jg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Combining hash values (Dean Rasheed <dean.a.rasheed@gmail.com>) |
Список | pgsql-hackers |
On Mon, Aug 1, 2016 at 7:24 AM, Dean Rasheed <dean.a.rasheed@gmail.com> wrote: > On 1 August 2016 at 08:19, Greg Stark <stark@mit.edu> wrote: >> Surely combining multiple hashes is the same problem as hashing a block of >> memory? Shouldn't we just use the same algorithm as hash_any()? > > Yes, I imagine that should work well. I suspect that Thomas's proposal > would also probably work well, as would a number of other hashing > algorithms with reasonable pedigree, such as the one used for array > hashing. I don't have any particular preference, but I do know that > what usually turns out to be disastrous is an arbitrary made-up > formula like rotating and xor'ing. The last thing we should attempt to > do is invent our own hashing algorithms. +1. (x << 1) | y isn't the stupidest way of combining hash values anybody's ever invented, but there are surely others that are better. I don't much care whether we adopt Thomas's proposal or Greg's or something else, but I can't see why we'd stick with (x << 1) | y when better approaches are known. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
В списке pgsql-hackers по дате отправления: