Datatype performance

  • Hello

    This may be a stupid question but are there any performance difference between different data type.

    For this query :

    select * from Table where column = @column

    is a bigint column gonna be faster than a binary(8) or a char(8) column ?

    Is this the same for an insert with an unique key or in a table join ? is there a datatype that will perform better?

    There is surely an article on this subject somewhere , but i wasnt able to find one.

  • Usually integer columns are a bit faster than string columns.

    So for a primary key it's a good idea to take an integer column, instead of a string column or a GUID.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thank you for the info

    If string is the slowest, is there any difference between a integer and a binary field ?

  • Faster in this case does not mean noticably or measurably faster. Maybe a few microseconds for a simple comparison like that. Joins show more of an effect, but you still need to be doing huge joins to notice.

    Use the appropriate data type for the data value that you are going to store. Test. If performance is unacceptable, then come back and do strange things (like binary(8) in the name of performance)

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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