October 22, 2010 at 2:18 pm
Grant Fritchey (10/22/2010)
It sounds like a parameter sniffing issue. A quick fix would be to recompile the procedure on prod and see if the plan changes.
I use a local variable inside proc to prevent the sniffing. 😎
October 22, 2010 at 3:51 pm
I think you have more number of rows of data in your prod tables than your stage server.
This is what the issue the tables you use in your store proc may have more data in production .
Always consider the tables using in the store proc
Step wise tuning I follow
--> Execution plan
--> Indexes
--> Code bugs
--> Data in tables.
--> hope fully
Thanks,
October 23, 2010 at 1:27 pm
So did you ever find out why the same thing ran slow on one server and fast on another?
And could someone please explain what you mean by "parameter sniffing"? Thanks!
October 23, 2010 at 2:52 pm
Oksana March (10/23/2010)
So did you ever find out why the same thing ran slow on one server and fast on another?And could someone please explain what you mean by "parameter sniffing"? Thanks!
There must be 1000 posts on this site about that. Just search for it and you'll find all you need to know.
October 23, 2010 at 3:07 pm
Oksana March (10/23/2010)
And could someone please explain what you mean by "parameter sniffing"? Thanks!
http://sqlinthewild.co.za/index.php/2007/11/27/parameter-sniffing/[/url]
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
October 25, 2010 at 8:14 am
Not sure if this is really a parameter sniffing issue...
I added the 'with RECOMPILE' option to the end of my proc
Declare @nRC int, @rnSQLError int
exec @nRC = psp_x_hist_inq 'D','00400003414', 'CK',null, null, null,null,null,null,null,null,null,null, 'DP','10/20/2010', 0, Y,2000,Y,152,0,@rnSQLError output, 'null', 'Y'WITH RECOMPILE
I also did a dbcc freeproccache
nothing helped..
do you guys still think it's a parameter sniffing issue?
October 25, 2010 at 8:17 am
Yes. Or more to the point, the wrong compiled plan is generated when using those parameters.
Assuming you saved the correct plan. Flush the proc cache from your test server and see what happens when you rerun the proc with the same parameters that are giving the correct plan on that server.
You may be able to reproduce the change.
Also another possible explaination. Check to see if you really have 100% identical setups (sql versions, patches, and close enough hardware).
October 25, 2010 at 8:30 am
I flushed the cache and re-ran the proc using same parameters..I can't make it run slowly on my stage server...I tried changing params and no matter which I choose it runs fast on both stage and my test server....but not in production..
There is a difference in SQL versions...
Production - is SQL 2005 Enterprise version...where my stage and test servers are both SQL05 standard ... both have service pack 2.
October 25, 2010 at 8:34 am
I'm out of ideas at this point... I'll call in reinforcement.
October 25, 2010 at 8:34 am
krypto69 (10/25/2010)
I flushed the cache and re-ran the proc using same parameters..I can't make it run slowly on my stage server...I tried changing params and no matter which I choose it runs fast on both stage and my test server....but not in production..There is a difference in SQL versions...
Production - is SQL 2005 Enterprise version...where my stage and test servers are both SQL05 standard ... both have service pack 2.
Have you tried moving the parameters into local variables to see if that fixed it?
October 25, 2010 at 8:35 am
October 25, 2010 at 8:38 am
thanks for all your help
I haven't tried moving the variables yet...this particular proc has 24 input params and is kind of a bitch...(I didn't write it)... 🙂
October 25, 2010 at 8:41 am
if this was parameter sniffing .
wouldn't I see scans in the execution plan?
I don't see scans...all seeks..the execution plan matches the one in stage which runs fast..
October 25, 2010 at 8:47 am
Have statistics been updated on both servers? The indexes rebuilt the same way? Besides the version of sQL Server, is there more/less memory, faster/slower processors, more/fewer disk drives, more/fewer drive controllers...
It has to be something.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
October 25, 2010 at 8:48 am
krypto69 (10/25/2010)
if this was parameter sniffing .wouldn't I see scans in the execution plan?
I don't see scans...all seeks..the execution plan matches the one in stage which runs fast..
If scans/seeks/whatever, if the data is identical and the plans are identical, then you should see roughly the same performance... unless, you've got contention or there's a radical difference in the hardware.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 15 posts - 31 through 45 (of 60 total)
You must be logged in to reply to this topic. Login to reply