Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
learntsql
524 Posts |
Posted - 2010-01-18 : 04:43:01
|
Hi.In my stored procedure i accept two parameters Month and Year.Values for these parameters will come from front end.Initially i was directly using these parameters in where clause, Query was executing very slow.Then I defined two local variables and assigned these parameters values to local variables and using those local variables in WHERE CLAUSE instead of using directlu paramter values.Now the query is executing with in time.What would be the reason between in two cases?What other ways i can improve the query performance? |
|
Kristen
Test
22859 Posts |
Posted - 2010-01-18 : 04:48:31
|
"What would be the reason between in two cases?"Sounds like "parameter Sniffing" to me"What other ways i can improve the query performance?"Tune them. Look at the Query Plan. See what aspects are not using the indexes you would expect them to, where you are getting INDEX SCANS instead of INDEX SEEKS, or TABLE SCANS, adding indexes to see if that changes the Query Plan. Trying to add additional columns to the Indexes to see if they COVER the query better and result in less logical I/O than before. |
|
|
learntsql
524 Posts |
Posted - 2010-01-18 : 05:36:46
|
Thank you. |
|
|
|
|
|