2010-08-29 75 views

回答

2

對不起,這不是一個評論,但那不是一個選項呢。

您返回多少條記錄?你有沒有看過報表服務器執行表,看看數據複製和渲染所花費的時間?

如果報告中有大量返回的頁面,則報告流即ie .. 1 of 2?還是在渲染第一個之前返回所有頁面?

報表是否每次調用時都需要這麼多時間,還是僅僅是第一次,基本上一旦計劃緩存,它運行得很快?可能會造成問題。

編輯:對您的報表服務器數據庫運行此腳本。它會給你提供比你想要的更多的信息,但是,如果你通過報告名稱排序,你可以查看數據檢索時間,處理時間或處理和渲染時間。這會告訴你實際正在採取的時間。此外,您的報告服務器將默認保存最近60天,因此如果您只想說昨天,則取消註釋where子句之間的日期。

declare 
@ReportPath varchar(200) 
,@DayCount int 

set @ReportPath = 'ALL' 
set @DayCount = -1 * @DayCount 

select 
    reverse(substring(reverse(el.ReportPath),1,charindex('/',reverse(el.ReportPath))-1)) as ReportName 
    ,u.UserName as LastModBy 
    ,coalesce(cast(el.parameters as varchar(max)),'') as [Parameters] 
    ,round(datediff(ss,el.TimeStart, el.TimeEnd)/60,0,1) DurationMin 
    ,case 
     when datediff(ss,el.TimeStart, el.TimeEnd) > 59 
      then datediff(ss,el.TimeStart, el.TimeEnd) % 60 
     else datediff(ss,el.TimeStart, el.TimeEnd) 
    end as DurationSec 
    ,case 
     when dt_el2.AvgDuration60Day > 59 
      then cast(round(dt_el2.AvgDuration60Day/60,0,1) as varchar(20)) + ' min ' + cast((dt_el2.avgduration60day % 60) as varchar(20)) + ' sec' 
     else cast(dt_el2.AvgDuration60Day as varchar(20)) + ' sec' 
    end as AvgDuration60Day 
    ,case 
     when dt_el2.TotalDuration60Day > 59 
      then cast(round(dt_el2.TotalDuration60Day/60,0,1) as varchar(20)) + ' min ' + cast((dt_el2.TotalDuration60Day % 60) as varchar(20)) + ' sec' 
     else cast(dt_el2.TotalDuration60Day as varchar(20)) + ' sec' 
    end as TotalDuration60Day 
    ,case 
     when dt_el2.MinDuration60Day > 59 
      then cast(round(dt_el2.MinDuration60Day/60,0,1) as varchar(20)) + ' min ' + cast((dt_el2.MinDuration60Day % 60) as varchar(20)) + ' sec' 
     else cast(dt_el2.MinDuration60Day as varchar(20)) + ' sec' 
    end as MinDuration60Day 
    ,case 
     when dt_el2.MaxDuration60Day > 59 
      then cast(round(dt_el2.MaxDuration60Day/60,0,1) as varchar(20)) + ' min ' + cast((dt_el2.MaxDuration60Day % 60) as varchar(20)) + ' sec' 
     else cast(dt_el2.MaxDuration60Day as varchar(20)) + ' sec' 
    end as MaxDuration60Day 
    ,dt_el2.Count60Day 
    ,(select count(*) from executionlog2 tmp where tmp.reportpath = el.reportpath and tmp.username = el.username and tmp.reportaction = 'Render' and tmp.status = 'rsSuccess' group by tmp.ReportPath) as UserCount60Day 
    ,el.Format 
    ,el.UserName 
    ,el.ReportAction 
    ,el.Status 
    ,el.Source 
    ,el.[RowCount] 
    ,el.ExecutionId 
    ,el.TimeDataRetrieval/1000 as DataRetrieval 
    ,el.TimeProcessing/1000 as Processing 
    ,el.TimeRendering/1000 as Rendering 
    ,(el.TimeProcessing + el.TimeRendering)/1000 as ProcessAndRender 
    ,el.AdditionalInfo 
    ,case 
     when datediff(ss,el.TimeStart, el.TimeEnd) >= 30 
      then 1 
     else 2 
    end as DisplayInRed 

from 
    ExecutionLog2 el 
    join ReportServer.dbo.Catalog c 
     on c.Path = el.ReportPath 
    join ReportServer.dbo.Users u 
     on u.UserId = c.ModifiedByID 
    join(
      select 
       reportpath 
       ,sum(datediff(ss,timestart,timeend)) as TotalDuration60Day 
       ,max(datediff(ss,timestart,timeend)) as MaxDuration60Day 
       ,min(datediff(ss,timestart,timeend)) as MinDuration60Day 
       ,avg(datediff(ss,timestart,timeend)) as AvgDuration60Day 
       ,count(*) as Count60Day 
       --,count(*) over(partition by username) as UserCount60Day 
      from 
       executionlog2 
      where 
       reportaction = 'Render' 
       and status = 'rsSuccess' 
      group by reportpath 
     ) dt_el2 on el.ReportPath = dt_el2.ReportPath 


where 
    (@reportpath = 'ALL' or el.ReportPath = @reportpath) 
    --and el.TimeStart between 
     --convert(varchar,dateadd(dd,@daycount,getdate()),112) + ' 00:00:00.000' and 
     --convert(varchar,getdate(),112) + ' 23:59:59.000' 
    and el.ReportPath != 'Unknown' -- exclude reports that have been deleted after executing 
    and el.ReportAction = 'Render' 

order by durationmin desc, DurationSec desc; 
+0

那點。它返回像十幾條記錄,它是一頁報告......什麼是編譯問題?彙編什麼和如何找到它? – 2010-09-03 11:39:50

+0

我想弄清楚你是否有渲染問題,或者如果你有SQL性能問題。當在ssms中執行查詢或第一次運行報表時,它將執行編譯以查找最佳查詢計劃並將其緩存。如果它是一個非常複雜的查詢計劃,那麼編譯需要很長時間,但是一旦它在緩存中運行後,它將會很快,因爲您跳過了編譯。您可以看到的最好的事情是報表服務器執行表。我將編輯我的答案給你一個查詢,以告訴它的數據檢索或呈現。 – user404463 2010-09-03 12:16:19

0

你在2008 R2嗎?如果是這樣,請確保您使用CU3,R2非常麻煩。

+0

不只是2008年...... – 2010-09-02 11:25:55

0

我注意到使用設置爲調用存儲過程的數據集與設置爲使用文本SQL查詢的數據集之間的區別,但所有文本都調用相同的SP。

EXEC custom_sp_name_here 

在我所看到的,調用SP的測試SQL查詢比將數據集設置爲存儲過程要好得多。

Jamie F

+0

我也使用查詢調用SP ... – 2010-09-03 11:40:20

2

最近,我經歷了一個非常類似的問題與SSMS的SQL查詢返回約1000行數據的相對快速(2秒),但報告本身花了幾分鐘來呈現結果。

在SSRS中設置報表屬性「InteractiveSize」會強制報表爲返回的數據分頁,而不是嘗試在一個頁面中呈現所有內容。

這減少了將報告縮短到3秒所需的時間。

〜Rantscant

相關問題