Indexing a character column

  • Dear All,
    Can anybody with a good web link or some material on 'Indexing on Numeric column types. I have some assignment on Performance Tuning where in a majority of table columns in where clauses are Non - numeric. Thank you.

    Regards......Arshad

  • First, a bit of clarity, the title says "Indexing a character column". Then you type that you want "Indexing on Numeric column types" and then you say that the majority of the columns are non-numeric. So we're clear, you're worried about indexing on non-numeric, strings, yes?

    The short answer is that indexing on numbers and indexing on strings is basically the same. An equality argument for 42 or 'dog' in an index would work exactly the same way. So, depending on your queries and your columns, there's not a whole lot to say that's different between numbers and strings.

    The issues come around when we start talking about stuff other than straight forward normalized data (FirstName, LastName, etc) and have very long strings that exceed the limit on an index (1700 bytes). Then you have to start looking at other mechanisms of indexing such as fulltext indexes. Same thing goes when instead of simple searches using equality (or even greater than, less than, etc.) and you're trying to search within the string as well as matching it. Again we're talking about full text indexing. However, if you really want to do lots of searches on unstructured strings, you're actually better off leaving SQL Server and using some other type of storage engine.

    If you can clarify a little more what you're looking for, we can give you a little better guidance.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Hi Grant,
    Thanks for pointing out my typo. Yes, I meant the data type of those columns in question being Non-Numeric. Was a bit concerned about the search mechanism in an index for string data types but as you say its the same like numeric , my question is answered . Thank you so much.

    Best Rgds
    Arshad

  • Arsh - Tuesday, September 4, 2018 6:40 AM

    Hi Grant,
    Thanks for pointing out my typo. Yes, I meant the data type of those columns in question being Non-Numeric. Was a bit concerned about the search mechanism in an index for string data types but as you say its the same like numeric , my question is answered . Thank you so much.

    Best Rgds
    Arshad

    Sorry if that came across as offensive. I just wanted to be clear so I answered the question you were asking.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply