Re: Hashes from composite keys?

From: Eric <eric_at_deptj.eu>
Date: Fri, 23 Jul 2010 22:14:41 +0100
Message-ID: <slrni4k1i1.sb4.eric_at_teckel.deptj.eu>


On 2010-07-23, Karsten Wutzke <kwutzke_at_web.de> wrote:
> On 23 Jul., 22:22, Bob Badour <bbad..._at_pei.sympatico.ca> wrote:
>> Karsten Wutzke wrote:
>> > Hello,
>>
>> > what are the best practices for generating hash codes from composite
>> > keys? I need to mimic something like what a composite index does. In
>> > fact, it's for mapping between relational keys and object IDs.
>>
>> > Can anyone point me into the right direction please?
>>
>> > Karsten
>>
>> Yes, I can point you in the right direction. Simply turn completely
>> around from what you are trying to do, and go in the opposite direction.
>
> One of the most useless comments on the Usenet I've read in my whole
> life. Congratulations. You must have a lot of time for writing such a
> crap. If you think you are cool, you're not.
>
> Anyone else with a useful tip? XORing the individual elements?
>
> Karsten

He genuinely believes that both what you want to do and why you want to do it are very bad ideas indeed. There are sensible arguments behind that opinion, but presenting them here usually results only in a spate of ill-considered counter-arguments from people who know nothing about it. They won't answer your question either.

If you want hash codes, they are a topic in their own right, which you can look up, or ask about elsewhere. The fact that the data you want to hash happens to be a composite key in a database is pretty-much irrelevant.

Alternatively, you may wish to take a step back from your problem, and ask again the questions to which your answers were "mapping" and "hash codes". Here may or may not be the right place for that.

Finally, if you think that his response, or even mine, are the most useless comments on Usenet (_not_ "the Usenet"), you haven't read very much of it. Asking you to re-consider the reasoning that led to your question is potentially very useful indeed.

Eric Received on Fri Jul 23 2010 - 23:14:41 CEST

Original text of this message