Hash for varChar fields.

Ruslan Zasukhin sunshine at public.kherson.ua
Mon Nov 14 10:46:39 CST 2005


On 11/14/05 12:51 AM, "Ed Kleban" <Ed at Kleban.com> wrote:

Hi Ed,

> Hi Ruslan,
> 
> I'm working with a unique varChar(504) field that will have lots of strings
> of average length of say 30 chars.
> Normally, if I were not using a database, I'd create us a hash table, such
> as the Einhugur ObjectDictionary class to store and rapidly lookup strings.
> I'm wondering if it would be worth while to create a hash of the string, say
> using the RB variant.hash method, and store this in a parallel field of the
> table containing the unique VarChar field, as a means of accelerating
> lookups.   Binary Searches for the LongInt hash field would presumbably be
> much faster than binary searches on the varChar field.   Does this sound
> like a reasonable approach, or am I mising something?

Yes this is good idea, just note, with hash you can do searches only as

    WHERE fld = xxxx

But not 

    WHERE fld > xxx


> I'd still have to handle hash collisions of course if the text didn't
> match... Which raises an interesting question.  If I knew which entry of the
> index table for the hashfield was associated with the FindFirst call, then I
> could just check varchar records identified by successive rows in the index
> table for all matching hash values.  Is there a way to access the the index
> table and use it in this manner?

Valentina 2.0 have for this method

    Vfield.ExistsValue( )

also

    Vfield.FindValue( )


-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the Valentina mailing list