SQL Server Performance

difference

Discussion in 'T-SQL Performance Tuning for Developers' started by shivg, Dec 20, 2005.

  1. shivg New Member

    hi everybody


    Pllease guide me about what is the difference with respect to performance in this query


    1.) select * from employee where increment >= 0 and increment <= 1000
    2.) select * from employee where increment between 0 and 1000



    we had a clustered index on increment column whose data type is IDENTITY(1,1), and this table had 1000000 of rows


    shiv



  2. FrankKalis Moderator

  3. dineshasanka Moderator

    both will use Clustered Index seek. so there won't b any differences.

    if you have choiuce between In and Between between is the best

    ----------------------------------------
    http://spaces.msn.com/members/dineshasanka
  4. FrankKalis Moderator

  5. Madhivanan Moderator

    I think he meant to say if you have choices between In and Between between is the best. Isnt it Dinesh?

    Madhivanan

    Failing to plan is Planning to fail
  6. FrankKalis Moderator

  7. Adriaan New Member

    Can't see how IN applies here. IN can take either a subquery, or a list of specific values, but it does not support ranges of values (unlike the LIKE clause, which supports expressions like [a-z], [0-9] etc.).
  8. FrankKalis Moderator

    I meant the &gt;= ...&lt;= combination is equivalent to BETWEEN. Therefore I wanted to know why Dinesh would prefer BETWEEN. I didn't read the IN here. Probably it was IN BETWEEN. [<img src='/community/emoticons/emotion-2.gif' alt=':D' />]<br /><br />--<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />Heute schon gebloggt?<a target="_blank" href=http://www.insidesql.de/blogs>http://www.insidesql.de/blogs</a><br />

Share This Page