July 5, 2007 at 11:38 pm
Hello everyone, me using SQL Server 2000, i want to know abt the operations that performed on select stmt. I have 2 cases:
Case1:
Select statement working, if i give a criteria select Count(ID) from table1 where code=1, and i know in the code column unqiue codes are present and id is also unique, then kindly tell me abt the working of that select stmt, either it checks the whole table (check all rows let say 500 rows or data is inserted in table1 or stop checking when its get the desired result e.g at 5 row or 100 row it get the data now select stmt stops its operation and not looking further or go through the whole 500 lines?
kindly tell me in that case 2 if i used only select id from table1 where code =1 its again stop its operation after getting the desired result or scan the whole table1 (not Count involved).
Thanx in advance.
July 6, 2007 at 12:26 am
Hello Isa,
the way SQL server executes your query depends on the fact if the table has (usefull) indexes or not and the size of the table. The query optimizer determines if it is faster to use a index seek or to do a scan based on statistics. The easiest way to determine what happens is to enable the "show execution plan" option in QA or using the SET SHOWPLAN_TEXT ON statement before your select statement.
Markus
[font="Verdana"]Markus Bohse[/font]
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply