Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2015
    Posts
    38
    Provided Answers: 1

    Unanswered: Error Source: .Net SqlClient Data Provider Error Message: Timeout expired.

    Believe me this has been one of the most elusive answers I have ever looked for. I have spent all afternoon reading more than a dozen posts on this subject and am still stuck. I have a database query that sums up data on a 55 million record table. It runs in about 3-4 minutes in a query window and returns 97 records. When you crunching 75 million records it just going to take a minute or two. I created a view with the same query and when I execute it from the View designer window after about 30 seconds it gives me the error below. I also get the error when I try to access the view from a SSRS dataset. 30 seconds being the default timeout for MS products I figure somewhere some hidden layer is saying even though your application and the server says let it run I'm cutting this off at 30 seconds.
    I have set every connection timeout I can find to 0. Nothing seems to be working. The message indicates the message is coming from ".Net SqlClient Data Provider". Is there another layer other than the Visual Studio or SQL Server 2008R2 I am missing. Please Help I need to figure this out. Thanks in advance.

    ---------------------------
    Microsoft Visual Studio
    ---------------------------
    SQL Execution Error.

    Executed SQL statement: SELECT TOP (100) CycleDate, [Job Num], MailDate, TotalPieces, Scaned, PctScaned, NotScaned, PctNotScaned, PctLT7, PctBT7_10, PctGT10, STC, PctSTC, AvgOfWorkDays, AvgOfTotalDays FROM CT1_Report_View_1
    Error Source: .Net SqlClient Data Provider
    Error Message: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
    Just in case you curious here is the SQL that creates the view.
    Code:
    SELECT     
    TOP (100) PERCENT v1.CycleDate, v1.JobNum AS [Job Num], v1.MailDate, v1.TotalPieces, v2.Scaned, v2.Scaned / v1.TotalPieces AS PctScaned, v2.NotScaned, v2.NotScaned / v1.TotalPieces AS PctNotScaned, v2.LT7 / v1.TotalPieces AS PctLT7, v2.BT7_10 / v1.TotalPieces AS PctBT7_10, v2.GT10 / v1.TotalPieces AS PctGT10, v2.STC, v2.STC / v1.TotalPieces AS PctSTC, v2.AvgOfWorkDays, v2.AvgOfTotalDays
    FROM dbo.CT1_Jobs_Table AS v1 INNER JOIN
                 (SELECT     JobNum, CAST(SUM(CASE WHEN STC_SCAN IS NULL THEN 0 ELSE 1 END) AS decimal) AS Scaned, CAST(SUM(CASE WHEN STC_SCAN IS NULL THEN 1 ELSE 0 END) AS decimal) AS NotScaned, CAST(SUM(CASE WHEN WorkDays] < 7 THEN 1 ELSE 0 END) AS Decimal) AS LT7, CAST(SUM(CASE WHEN [workDays] BETWEEN 7 AND 10 THEN 1 ELSE 0 END) AS decimal) AS BT7_10,  CAST(SUM(CASE WHEN [WorkDays] > 10 THEN 1 ELSE 0 END) AS decimal) AS GT10, CAST(SUM(CASE WHEN STC_SCAN = 'YES' THEN 1 ELSE 0 END)  AS decimal) AS STC, AVG(WorkDays) AS AvgOfWorkDays, AVG(TotalDays) AS AvgOfTotalDays
                 FROM          dbo.CT1_View_1
                 GROUP BY JobNum) AS v2 ON v1.JobNum = v2.JobNum
    WHERE     (v1.MailDate >= DATEADD(WEEK, - 13, GETDATE()))
    ORDER BY v1.MailDate, [Job Num]
    Last edited by wjburke2; 10-06-16 at 20:30.

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    can you pre-aggregate or does this data need to be "live"?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Mar 2015
    Posts
    38
    Provided Answers: 1
    Quote Originally Posted by Thrasymachus View Post
    can you pre-aggregate or does this data need to be "live"?
    It would be nice to show live data but it looks like I will have to sum-up the data weekly or daily. I have a query that creates another table called CT1_Summary. It compresses the data from 15mil records to 15mil. Then my reports seem to have no problem handling the data. The create table query takes around 20 minutes to run, the view takes 3 minutes not sure why a query outside a report can run 20 minutes and one called from a report crashes after 30 seconds. Anyway that is the solution I came up with.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •