Performance Difference in comparing integers and comparing strings

前端 未结 4 2203
攒了一身酷
攒了一身酷 2021-02-07 02:24

Can anyone provide any concrete evidence of performance when comparing

int = int

and:

string = string

in

4条回答
  •  日久生厌
    2021-02-07 02:32

    Put both of your queries in the same query window. At the very top (before either of these queries) put: SET STATISTICS IO ON

    When you run the code run it with the option "Include Actual Execution Plan" (an icon on your toolbar which looks like three little boxes, about 7 icons to the right of the Execute button)

    This will result in three tabs in your results: Results, Messages, Plan. The Messages and the Plan will show you the IO cost and the full Execution cost.

    The query with the bigger numbers has the highest cost! This method will allow you to prove to yourself which query has the lowest cost (highest performance)

提交回复
热议问题