Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:40:00+00:00 2026-06-11T07:40:00+00:00

What is internal working of db2 for comparing strings ? i have a query

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:40:02+00:00Added an answer on June 11, 2026 at 7:40 am

    First Question

    What is the internal working of DB2 for comparing strings ?

    The simple answer is case sensitive matching.

    The more complicated answer is provided by IBM. IBM is famous for complicated answers.

    Two strings are compared by comparing the corresponding bytes of each string. If the strings do not have the same length, the comparison is made with a temporary copy of the shorter string that has been padded on the right with blanks so that it has the same length as the other string.

    Two strings are equal if they are both empty or if all corresponding bytes are equal. An empty string is equal to a blank string. If two strings are not equal, their relationship (that is, which has the greater value) is determined by the comparison of the first pair of unequal bytes from the left end of the strings. This comparison is made according to the collating sequence associated with the encoding scheme of the data. For ASCII data, characters A through Z (both upper and lowercase) have a greater value than characters 0 through 9. For EBCDIC data, characters A through Z (both upper and lowercase) have a lesser value than characters 0 through 9.

    Varying-length strings with different lengths are equal if they differ only in the number of trailing blanks. In operations that select one value from a collection of such values, the value selected is arbitrary. The operations that can involve such an arbitrary selection are DISTINCT, MAX, MIN, and references to a grouping column. See the description of GROUP BY for further information about the arbitrary selection involved in references to a grouping column.

    Second Question

    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?

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on internal PHP application where users login only from our network
I am working on CustomSiteMapProvider that i have Derived from StaticSiteMapProvider. I have override
I am a developer working on an internal web-based application, and I have been
i am working on an API for internal use and my SQL query is
I have been wanting to know for some time, how the internal working is
I've been working on an internal site that has Apache / PHP running. I
I am working on L-system interpreter and I use quaternion as internal representation of
OleDbDataAdapter internal error: invalid row set accessor: Ordinal=6 Status=UNSUPPORTEDCONVERSION All I'm doing is trying
I have an internal class A that does a lot of stuff and I
We have an internal asp.net forms app where one page is essentially a WYSIWYG

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.