SQL Server Performance Forum – Threads Archive
Clustered Index Scan Issue
Hi All<br /><br />I have this follwoing simple query and have problem to solve clustered Index Scan issue.<br /><br />CREATE TABLE #Temp<br /> (col1 int null, <br /> col2 money null, <br /> col3 smallint null)<br /><br />INSERT INTO #Temp (col1,col2,col3)<br />SELECT ap1, sum(ap2), Max(ap3)<br />FROM dbo.ap<br />GROUP BY ap1<br /><br />This gave me this follwing execution plan:-<br />|–Table Insert(OBJECT<img src=’/community/emoticons/emotion-6.gif’ alt=’![Frown :( :(](styles/default/xenforo/smilies/frown.png)
![Frown :( :(](styles/default/xenforo/smilies/frown.png)
![Frown :( :(](styles/default/xenforo/smilies/frown.png)
![Frown :( :(](styles/default/xenforo/smilies/frown.png)
![Frown :( :(](styles/default/xenforo/smilies/frown.png)
![Frown :( :(](styles/default/xenforo/smilies/frown.png)
I might miss something, but why do you expect a seek when you have to read the whole table anyway? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)
Hi Frank Kalis thanks for rapid response… SEEK will be faster and directly go to the required rows to produce result sets… what do you think??? cos that’s what i have read on this site…or you can guide me on "INSERT INTO Select…." statement tuning.
I think it is happen cos of records are computing, grouping and inserting into temp table.. but i am not sure about it and that’s where i need help from experts on this site.. thanx a lot
Like Frank said, the reason for the index scan is that you are not filtering the data, and so all rows must be read anyway. A seek can only be faster if you are filtering data.
Yes, maybe when you can apply a WHERE clause you get a seek. Are you experiencing any performance issues? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Ich unterstütze PASS Deutschland e.V. http://www.sqlpass.de)
]]>