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 |
dolphin123
Yak Posting Veteran
84 Posts |
Posted - 2012-09-13 : 14:58:32
|
Hi,The following query used to take 200 seconds (Client statistics - Wait time on server replies). Now it takes 400 to 500 ms.The server is decent. This started only yesterday morning.I restored 3 non-related databases on the same server. The difference was not big. Not sure how that could have any impact on this. But I just wanted to let you know what happened.Can you please let me know what can be my next step in fixing this or investigating more. Thanks for your time.. declare @p12 intset @p12=101declare @p13 numeric(29,4)set @p13=0.0063declare @p14 numeric(29,4)set @p14=324.3428declare @p15 numeric(29,4)set @p15=480.1358declare @p16 numeric(29,4)set @p16=766.0878declare @p17 intset @p17=100declare @p18 numeric(29,4)set @p18=10.0000declare @p19 intset @p19=2500declare @p20 intset @p20=10declare @p21 numeric(29,4)set @p21=225.0000declare @p22 numeric(29,4)set @p22=550.0000declare @p23 intset @p23=708516declare @p24 varchar(max)set @p24=NULLdeclare @p25 numeric(29,4)set @p25=32.9500declare @p26 varchar(max)set @p26='US'declare @p27 varchar(max)set @p27='Fid'declare @p28 varchar(max)set @p28='Comm.gif'declare @p29 varchar(max)set @p29='PPM_eng.gif'declare @p30 varchar(max)set @p30=NULLdeclare @p31 intset @p31=1declare @p32 intset @p32=1declare @p33 numeric(29,4)set @p33=325.0000declare @p34 numeric(29,4)set @p34=0.0000declare @p35 numeric(29,4)set @p35=125.0000declare @p36 numeric(29,4)set @p36=349.6084declare @p37 numeric(29,4)set @p37=0.0000exec CommCheck @Ad_Id='G6253', @Units=350, @Price=83.59, @F_Id=23, @HHTier=0, @CrossClient=0, @CrossHHTier=1, @SchedCommInput=497.72, @ProposedCommission=500, @LanguageId=1, @WithMessages=0, @Count=@p12 output,@AvgDistance=@p13 output,@AvgCommission=@p14 output,@TopQuartileLow=@p15 output,@TopQuartileHigh=@p16 output,@RepresentativeSampleSize=@p17 output,@PriceOut=@p18 output,@UnitsOut=@p19 output,@UniverseFirms=@p20 output,@ProposedCommissionOut=@p21 output,@SchedCommOutput=@p22 output,@UniverseTradesCount=@p23 output,@XMLMessages=@p24 output,@DiscountBrokerageRate=@p25 output,@Country=@p26 output,@DiscountBrokerageFirm=@p27 output,@CCheckLogo=@p28 output,@PMLogo=@p29 output,@Warning=@p30 output,@LanguageIdOut=@p31 output,@CrossClientOut=@p32 output,@DiscountSharingBegins=@p33 output,@DiscountSharingChargeBack=@p34 output,@DiscountSharingNoPayout=@p35 output,@MedianCommission=@p36 output,@FirmMinimum=@p37 outputselect @p12 [count], @p13 [AvgDistance], @p14 [AvgCommission], @p15 [TopQuartileLow], @p16 [TopQuartileHigh], @p17 [RepresentativeSampleSize], @p18 [PriceOut], @p19 [UnitsOut], @p20 [UniverseFirms], @p21 [ProposedCommissionOut], @p22 [SchedCommOutput], @p23 [UniverseTradesCount], @p24 [XMLMessages], @p25 [DiscountBrokerageRate], @p26 [Country], @p27 [DiscountBrokerageFirm], @p28 [CCheckLogo], @p29 [PMLogo], @p30 [Warning], @p31 [LanguageIdOut], @p32 [CrossClientOut], @p33 [DiscountSharingBegins], @p34 [DiscountSharingChargeBack], @p35 [iscountSharingNoPayout], @p36 [MedianCommission], @p37 [FirmMinimum] |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dolphin123
Yak Posting Veteran
84 Posts |
Posted - 2012-09-13 : 15:46:37
|
Thanks a lot Tara.I ran the following on all tables on the database in question.But the server response time did not change:USE <DBNAME>;GOUPDATE STATISTICS <tablename>WITH FULLSCAN Should I be doing something after updating the stats on the table? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
dolphin123
Yak Posting Veteran
84 Posts |
Posted - 2012-09-13 : 16:07:07
|
Thanks again Tara.I got the following script from a friend of mine and I ran this and ran the script again and the response time went down to 200 ms. Thanks for pointing me in the right direction.Is the reason this one worked that it had the "DBREINDEX" on it?USE <DBNAME>GOEXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?', ' ', 80)"GOEXEC sp_MSforeachtable @command1="print '?' UPDATE STATISTICS ? WITH FULLSCAN"GODBCC FREEPROCCACHEGODBCC UPDATEUSAGE (0);GO |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|
|