Need for a Hash Table

  • Thread starter Thread starter Andibevan
  • Start date Start date
A

Andibevan

I have a database that records information about loads of files. At the
moment I am using the path of each file as a common field between the tables
but as some of the paths are 200 characters long this seems highly
inefficient.

I have heard about Hash Tables but need a couple of pointers:-

1) Would a hash table improve the efficiency of my DB
2) What sort of algorthm should I use to generate the hash table
3) Any examples anywhere on the net (can't find anything yet)

TIA

Andi
 
I have a database that records information about loads of files. At the
moment I am using the path of each file as a common field between the tables
but as some of the paths are 200 characters long this seems highly
inefficient.

I have heard about Hash Tables but need a couple of pointers:-

1) Would a hash table improve the efficiency of my DB
2) What sort of algorthm should I use to generate the hash table
3) Any examples anywhere on the net (can't find anything yet)

Rather than hashcoding the string, why not have a surrogate key? You
could have a table of Paths with an autonumber PathID and the 200+
byte (not over 255 I hope!!!) text string, and just use a long integer
PathID in the directory table.

John W. Vinson[MVP]
 
John Vinson said:
Rather than hashcoding the string, why not have a surrogate key? You
could have a table of Paths with an autonumber PathID and the 200+
byte (not over 255 I hope!!!) text string, and just use a long integer
PathID in the directory table.

John W. Vinson[MVP]

I was thinking that the advantage of using a hash value for each string
would have the advantage that you could calculate the value of a path
without actually needing to look anything up in a table. I presume it would
be faster to use a surrogate key as you suggest since the DB would only be
looking up numeric values not text.

Ta

Andi
 
Back
Top