2016-03-30 18 views
0

Çalıştırmak için uzun süren SSRS'de bir rapor yazıyorum. İşte olan: 9:46 AM ve 9: 56'da görüntüleme raporu düğmesine basıyorum, sonunda Yükleme açılır penceresini görüyorum. Rapor daha sonra bir dakika sonra gelir. SSRS rapor gecikmesini anlamaya çalışıyorum

Start: 3/30/2016 9:56:16 AM 
End: 3/30/2016 9:56:18 AM 
Elapsed: 0:01 

Yani bazı garip nedenle, SSRS raporu çalıştırmadan önce on dakika bekliyor: Aşağıdaki diyor orada biraz ayıklama görüntüler sıkışmış. Bu bir sorun çünkü dağıtılan rapor zaman aşımına uğradı. Düğmeye bastığımda raporun gerçekten işlenmeye başladığı zaman arasında ne olduğunu nasıl belirleyebilirim? Ek: Günlükler bir sorun olarak dışarı sızan hiçbir şey göstermiyor. SQL:

Terim:

Select Term_Code, Term_Seq_Id, Start_Date, Long_Desc 
From TERM 
Where (End_Date Between '2004-05-07' AND GetDate()) 
Order By Term_Seq_Id Desc 

RestrictionCount:

Select Count(*) as RestrictionCount from ReportUser Where LoginID = @User 

Bölümler:

Select distinct Sctn_id_code, subj_code, crse_code, sctn_code, sctn_term_code 
from siscrsi 
where sctn_term_code = @Term and subj_code in (@Subject) and crse_code in (@Courses) and (Pid = @Instructors or @Instructors = '<ALL>') 
order by sctn_term_code, subj_code, crse_code, sctn_code 

Kolejler:

If @RestrictionCount = 0 
    Select Coll_Code, Full_Name 
    From College 
    Order by Coll_Code 
Else 
    Select Distinct c.Coll_Code, c.Full_Name 
    From College as c 
    Inner Join sirssoctonlineforms.dbo.ReportUser as ru on ru.Coll_Code = c.Coll_Code 
    Where ru.LoginID = @User 
    Order by Coll_Code 

Konular:

Select distinct subj_code 
From section_info 
Where sctn_term_code = @Term and coll_code = @College and dept_code in (@Department) 
order by subj_code 

CoursesList:

Select Distinct Crse_Code, Subj_Code 
From SISCRSI 
Where Sctn_Term_Code = @Term 
    and Subj_Code = @Subject 
    and ((pid = @Instructors) or (@Instructors = '<ALL>')) 
Order by Crse_Code 

Eğitmenler:

Select 'blank' as sctn_term_code, '<ALL>' as pid, '<ALL>' as name 
union all 
Select distinct sctn_term_code, pid, name 
From sisinfo.dbo.SISCRSI instructor 
where sctn_term_code = @Term 
    and subj_code = @Subject 
order by name 

Bölümler:

If @RestrictionCount = 0 
    Select Dept_Code, Full_Name 
    From Dept 
    Where coll_code in (@College) 
    order by Dept_Code 
Else 
    Select Distinct d.Dept_Code, Full_Name 
    From Dept d 
    Inner Join sirssoctonlineforms.dbo.ReportUser as ru on ru.Dept_code = d.Dept_Code 
    Where ru.LoginID = @User and d.Coll_Code in (@College) 
    Order by Dept_Code 

Sorular:

Select count(*) as questionCount 
From Questions q 
Inner Join Form_Question fq on fq.Question_Id = q.Question_Id and  q.Question_Format_Group <> 'Text' 
Inner Join Response_Sets rs on rs.Form_Id = fq.Form_Id 
Where rs.Sctn_Id_Code in (@SectionCodes) 

NumberQuestions:

Select Top 1 dView.[Section Code], rSets.Form_ID, max(fq.Question_Order) as LastQuestion 
From Denormalized_V as dView 
Inner Join Response_sets as rSets on rSets.Sctn_ID_Code = dView.[Section Code] 
Inner Join Form_Question as fq on fq.Form_ID = rSets.Form_ID 
Where dView.[Section Code] in (@SectionCodes) 
Group by [Section Code], rSets.Form_ID 
Order by LastQuestion desc 

InstructorPID:

If @Instructors = '<ALL>' 
    Select 'NoName' as Name, 'Z000000000' as pid 
Else Begin 
    Select top 1 Name, pid 
    From SISCRSI 
    Where name = @Instructors 
End 

OptOutCount:

Select SectionInfo.Sctn_Id_Code as [Course Section ID], SectionInfo.Student_Cnt as [Total Students], Declined.Declined as [Total Declined] 
From SECTION_INFO SectionInfo 
Inner Join (
    select Sctn_Id_Code, count(Sctn_Id_Code) as [Declined] 
    From declined 
    Where Form_Id > 1 
    and Sctn_ID_Code in (@SectionCodes) 
    Group By Sctn_Id_Code 
) as Declined on SectionInfo.Sctn_Id_Code = Declined.Sctn_Id_Code 

ana rapor sorgu (yani çalıştırmak için üçten az saniye sürer):

If @nonTextQuestionCount > 0 
    Select * 
    From (
     Select si.Sctn_Id_Code as [Section Code], 
      si.Subj_Code as [Subject], 
      si.Crse_Code as [Course], si.Sctn_Code as [Course Section], 
      fq.Question_Order as [Question Number], 
      Case r.Instructor_PID 
       When 'ALL' Then 
        @InstructorName 
       Else 
        CRSI.Name 
      End as [Instructor Name], 
      rs.Set_Id as [Respondent Code], 
      Case rp.reply_ID 
       When 1 Then 
        r.response 
       Else rp.Reply_Text 
      End as [Reply Text] 
     From SECTION_INFO si 
     Inner Join Response_Sets rs on si.sctn_id_code = rs.Sctn_Id_Code 
     Inner Join Responses r on r.Set_Id = rs.Set_Id 
     Inner Join Questions q on q.Question_Id = r.Question_Id 
     Inner Join Form_Question fq on fq.Question_Id = q.Question_Id and fq.Form_Id = rs.Form_Id 
     Inner Join Forms f on f.Form_Id = fq.Form_Id 
     Inner Join Replies rp on rp.Reply_Id = r.Reply_Id 
     Left Outer Join SISINFO..SISCRSI CRSI on CRSI.PID = r.Instructor_PID 
         and si.Sctn_Id_Code = CRSI.sctn_id_code 
     Where si.Sctn_Term_Code = @Term 
     and si.Subj_Code = @Subject and si.Crse_Code in (@Courses) 
     and ((@Instructors = '<ALL>') or (r.Instructor_PID = @Instructors or r.Instructor_PID = 'ALL')) 
     and si.Sctn_Code in (@Sections) 
     and fq.Form_Id <> 1      
    ) as q1 
    Pivot (Max([Reply Text]) For [Question Number] in 
    ([1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], [16], [17], [18], 
    [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], [32], [33], [34], [35], 
    [36], [37], [38], [39], [40], [41], [42], [43], [44], [45], [46], [47], [48], [49], [50], [51], [52], 
    [53], [54], [55], [56], [57], [58], [59], [60], [61], [62], [63], [64])) 
    as p 
    group by subject, course, [subject], [course section], [Section Code], [Instructor_Pid], 
    [respondent code],[1], [2], [3], [4], [5], [6], [7], [8], [9], [10], [11], [12], [13], [14], [15], 
    [16], [17], [18], [19], [20], [21], [22], [23], [24], [25], [26], [27], [28], [29], [30], [31], 
    [32], [33], [34], [35], [36], [37], [38], [39], [40], [41], [42], [43], [44], [45], [46], [47], 
    [48], [49], [50], [51], [52], [53], [54], [55], [56], [57], [58], [59], [60], [61], [62], [63], [64] 
    order by [subject], [course], [course section] 
Else 
    Select * From 
    (
    Select rSets.set_id, dView.[Course section], dView.[Subject], dView.Course, dView.[Instructor pid], 
      answers.response, formQuestion.Question_Order, dView.[Section Code] 
    From Denormalized_V as dView 
    Inner Join response_sets as rSets on rSets.sctn_id_code = dView.[section code] 
    Inner Join responses as answers on answers.set_id = rSets.set_id 
    Inner Join questions as questions on questions.question_id = answers.question_id 
    Inner Join form_question as formQuestion on formQuestion.question_id = questions.question_id 
    where Term = @Term and 
     [Subject] = @Subject and 
     Course in (@Courses) and 
     ((@Instructors = '<ALL>') or (dView.[Instructor Pid] = @Instructors or dView.[Instructor Pid] = 'ALL')) and 
     dView.[Course Section] in (@Sections) and dView.[Survey Type] <> 'SOCT' 
) t 
Pivot (max(response) for question_order in ([1], [2], [3], [4], [5], [6], [7], [8])) as pvt 
+0

Neden her bir veri kümesi için sorguyu göndermiyorsunuz, bu yüzden raporunuzu yavaşlattığını görebiliyoruz. – SnakeFoot

+0

Talep edildiği gibi 14 sorgu ekledim. –

+0

Günlüğü nereden buldunuz? SSRS klasörünüzde ReportServerService günlük dosyasına erişebilir ve oturumun ne zaman yapıldığını doğrulayabilirsiniz? – cqi

cevap

0

Rapor sunucusunda konuşlandırıp raporu buradan çalıştırırsanız daha iyi bir sonuç elde edebilirsiniz. Her halükarda, gecikmenin sebebinin veri setlerinin sırasından kaynaklandığını düşünüyorum. Veri kümesi listesindeki sıralamayı, yürütme sırasını nasıl gösteriyor gibi görünüyor. Parametrelerin veri kümelerini bağladığınızda, listedeki sonuncu sonuncudur. Gecikme sebebiniz bu olabilir. Muhtemelen parametrelerin veri kümelerini listenin en üstüne koymak zorundasınız. Bunu yapmak için önce çalıştırıldığından emin olun ve diğer veri kümelerinin oluşturulmasını beklemeyin.

+0

Dağıtıldığında, zaman aşımına uğrar. Ne dediklerini görmek için Microsoft ile konuşacağız. –