Page 1 of 1

Question about Hashed Files

Posted: Mon Dec 22, 2003 9:36 pm
by admin
Hi all,

I just want to know whether it's advisable to use multiple keys in a hashed
file. I always use hashed files but with a single key. If I use multiple
keys, will I encounter any problems?

Thanks!!

Regards,
Chi

Question about Hashed Files

Posted: Mon Dec 22, 2003 9:52 pm
by admin
Hashed files can have more than one key column, from a metadata perspective. What happens is that the hashed file still only has one physical key (called @ID); if this is to contain more than one column a separator character is used (by default a "text mark", which can be specified via the @TM system variable). The individual key columns are defined in the file dictionary as virtual columns. There is also a storage location in the file dictionary that records any non-default separator character, and another that records the column names that make up the key.

There is a slight performance degradation when using multi-column keys with hashed files because, when you do a lookup based on your multi-column primary key, the underlying engine has to assemble the @ID value, which is then used as the argument to the hashing algorithm that locates the required record.

Even so, lookup performance using the entire key will still be quicker than performing a lookup against a remote database server.

Lookup performance using only part of the multi-column key, and lookup performance using anything other than an "equals" condition, will be horrible unless appropriate indexing is applied to the hashed file.


----- Original Message -----
From: "Chi Laborte"
Date: Mon, 22 Dec 2003 22:36:25 -0500
To:
Subject: Question about Hashed Files

> Hi all,
>
> I just want to know whether it's advisable to use multiple keys in a hashed
> file. I always use hashed files but with a single key. If I use multiple
> keys, will I encounter any problems?
>
> Thanks!!
>
> Regards,
> Chi
>
>