What is internal working of db2 for comparing strings ?
i have a query
select * from mytab where name=’rohit’
how name in each row is compared to value ‘rohit’
I am also thinking to have a column having hash code for each name(varchar) column having index on it. so whenever i look for a name, i should be looking for hashcode instead.
is this approach feasible and can gain performance?
First Question
The simple answer is case sensitive matching.
The more complicated answer is provided by IBM. IBM is famous for complicated answers.
Second Question
Yes, you can hash names. No, you won’t see any performance improvement.
The reason is that most of the time that DB2 spends going through a table or table index is used in disk input. The string matching of a name index is a tiny part of the processing time.
One thing you might consider implementing is a soundex matching of names.