Which one to compare 1'st String or Integer in a Where clause for better performance

  • I have a query which does validation before inserting/updating which is like

    SELECT TOP(1) @result_category_id = category_id

    FROM category_table

    WHERE language_id = @language_id

    AND status_id = @status_id

    AND type_id = @type_id

    AND category_str = @category_str

    I would like to know if there would be better performance if i compare the string 1'st instead of the id's ( i.e. all the id's are integer fields , but the result set returned from these general id's would be much bigger)

    ...Kumar

  • Since all conditions must be met (AND between them), I suppose it doesn't matter. Also, optimizer should be wise enough to chose best way of searching for information - like, use an index if it exists.

    ...and your only reply is slàinte mhath

Viewing 2 posts - 1 through 1 (of 1 total)

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