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 |
|
shubhada
Posting Yak Master
117 Posts |
Posted - 2007-02-26 : 05:05:35
|
| Hi,Is somebody will give me some idea about the parameter sniffing?What is parameter sniffing??How to overcome with this problem???I have one procedure that is causing this problem. Plz give me some tips to modify this proc to overcome this problemdbo.cm_test (@fromdate datetime = '01/01/1900',@thrudate datetime = '12/31/9999')AsBeginSET ANSI_WARNINGS OFFset nocount ondeclare @minln smallint,@CID char(24),@EID numeric(12,0),@extractdate datetime/* Begin gathering data */ select @extractdate = getdate() /* Begin gathering data */if exists (select * from tempdb..sysobjects where name like '#tmpWTClm%')drop table #tmpWTClmcreate table #tmpWTClm (ClaimID char(24) not null, EventID numeric(12,0) not null) insert into #tmpWTClm select Rem.ClaimID, Rem.EIDfrom Rem, RemOut2where Rem.CID= RemOut2.CIDandRem.EID= RemOut2.EIDand(ReimProcessDate between @fromdate and @thrudate)insert into #tmpWTClm select distinct ClaimID, EIDfrom PaymentsDetailwhere ProcessDate between @fromdate and @thrudate insert into #tmpWTClm select distinct ClaimID, EIDfrom ClaimDenialswhere DenialProcessDate between @fromdate and @thrudate insert into #tmpWTClm select distinct ClaimID, EIDfrom ClaimAppealswhere AppealProcessDate between @fromdate and @thrudate declare ClmDataCursor cursor forselect distinct ClaimID, EventIDfrom #tmpWTClm open ClmDataCursor fetch ClmDataCursor into @claimid, @EID while (@@fetch_status = 0) begininsert into WTDenialAppealExtract select distinct from Rem, Rem1 where Rem.CID= Rem1.CIDand Rem.EID= Rem1.EIDand Rem.CID= @CIDand Rem.EID= @eventidfetch ClmDataCursor into @CID , @EIDendclose ClmDataCursor Deallocate ClmDataCursorThanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-02-26 : 05:18:16
|
quote: Is somebody will give me some idea about the parameter sniffing?What is parameter sniffing??
found from google for "parameter sniffing"http://www.microsoft.com/technet/prodtechnol/sql/2005/recomp.mspxhttp://blogs.msdn.com/khen1234/archive/2005/06/02/424228.aspxquote: How to overcome with this problem???I have one procedure that is causing this problem.Plz give me some tips to modify this proc to overcome this problem
You have to tell us what problem is this ? KH |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-26 : 09:21:49
|
| You can use SQL Profiler with SP template to see which parameters that are passed to the stored procedures.Peter LarssonHelsingborg, Sweden |
 |
|
|
pootle_flump
1064 Posts |
Posted - 2007-03-01 : 08:03:53
|
quote: Originally posted by shubhada Hi,Is somebody will give me some idea about the parameter sniffing?What is parameter sniffing??How to overcome with this problem???I have one procedure that is causing this problem. Plz give me some tips to modify this proc to overcome this problem
HiI thought I recognised you from DBFhttp://www.dbforums.com/showthread.php?t=1615508I think you are going about this the wrong way round. If you are not sure what parameter sniffing is then how can you think that it is the cause of the problem? Parameter Sniffing is just one (of many) possible causes of performance problems. Start with the problem and work back to the cause.Anyway - when SQL Server creates an execution plan it takes account of the values of the parameters at the time of creating the plan. Subsequent calls to the procedure will (typically) use that same execution plan irrespective of the parameter values. This can cause performance problems if the execution plan is not efficient for sets of parameters that are being passed to the procedure.You can eliminate parameter sniffing pretty easily - recompile the procedure and run it again. If it still performs poorly then parameter sniffing is not the problem. If it does not the parameter sniffing may be the explanation.I haven't read over your proc in detail but I don't see that cursor as necessary nor efficient BTW.HTH |
 |
|
|
AndrewMurphy
Master Smack Fu Yak Hacker
2916 Posts |
Posted - 2007-03-01 : 09:16:01
|
| I also think 3 of your insert statements could be merged into one...(with "or" clauses in the WHERE statement) |
 |
|
|
|
|
|
|
|