SSRS Subscriptions Failing - Long TimeDataRetrieval Values - reporting-services

Good Morning-
I've got a SSRS report that runs 2 stored procedures. Each of these stored procedures take between 2-4 minutes to run when they are run through Management Studio.
I have subscriptions setup to run this report with different parameter values every day. Each day 5 copies of this report are supposed to be generated, each generated with a different parameter value. Today 3 of the 5 subscriptions failed. The error I see in the log for each failure today is:
Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: Cannot read the next data row for the dataset SectionLines.
When I look at the execution log in the report server DB, I see the TimeDataRetrieval value for the failed reports are > 3600000. This is strange, given the stored procedures only take a few minutes to run each, and definitely no more than 10 minutes.
Any clues for troubleshooting this?
Thanks!

Related

What is the best way to run a query continually on SQL Server

I have a table on an AS400 server (DB2) that I need monitor from SQL Server. If a record is written, I will take the data, do some stuff and then delete the record.
Currently, I wrote a C# windows services that runs the stored procedure every 500 ms and that works fine. But I want to run this store procedure completely from SQL if possible
I can't run from SQL Server Agent because 5 minutes is too long.
What is the best way to do this and furthermore, is there any issues with running int from a continual loop within the server?
This is my solution:
create a stored procedure that will loop using wait time and a while loop which will exit at a midnight and will run the stored procedure, wait 500 msec and then run it again
Run the looping stored procedure from SQL Server Agent daily at midnight
I will tweak the interval by maybe running the looping sp several times a day.
Thank you for your attention

SSRS report error-Object disconnected

I have an SSRS report which uses 4 datasets retrieving appox 1000 records each.
These records are presented in SSRS using grouping (row wise / column wise) to generate group counts and perecentages.
There are 4 such tables.
The procedures used to fetch data run in less tha 30 sec when run in SQL Server but the report takes much time to render:-
TimeDataRetrieval TimeProcessing TimeRendering
1250648 219 214
The behaviour is:-
In Visual Studio it is giving the error:-
Object has been disconnected or does not exist at the server.
When deployed in local it is at times rendering the report but taking 10 min or more.
Could you please suggest what could be the issue?
This could be a "parameter sniffing" issue. Try adding OPTION (RECOMPILE) to the end of your SQL code.

Reporting Services report runs slow on one server and fast on another

I have an odd problem. I have an identical code base and report on two different servers. Server A runs the report in 2 seconds. Server B runs the report in 15 seconds.
When running SQL Profiler, the duration of each stored procedure is the same. However, the end times of the procs are different. Server B seems to have something else going on between the procedures because the end times of the proc are so much longer.
I have no idea where to even begin looking into this issue. Any ideas?

Query execution failed for dataset. Server: The operation has been cancelled

An error has occurred during local report processing.
An error has occured during report processing.
Query execution failed for dataset 'DataSet_XXXXX'
Server: The operation has been cancelled.
What the William H Gates is going on here?
I am trying to preview a report, that uses datasets which connect to ssas cubes, in the report designer.
I'm using SSRS2008 on xpsp3
I changed the query to use a different dimension containing the same data and it works.
The number of dimensions used in the query was reduced from 3 to 2.
I guess by touching the other dimension it was creating a large dataset which in turn caused the error.
You need to pull the report apart and run each query manually to find the failure.

Why is Reporting Services report vastly slower than its query?

I have a query that takes roughly 2 minutes to run. It's not terribly complex in terms of parameters or anything, and the report itself doesn't do any truly extensive processing. Basically just spits the data straight out in a nice format. (Actually one of the reports doesn't format the data at all, just returns a flat table meant to be manipulated in excel.)
It's not returning a massive set of data either.
Yet the report takes upwards of 30 minutes to run.
What could cause this?
This is SSRS 2005 against a SQL 2005 database btw.
EDIT: OK, I found that with the addition of WITH (NOLOCK) in the report it takes the same time as the query does through SSMS. Why would the query be handled differently if it's coming from reporting services (or visual studio on my local machine) than if coming from SSMS on my local machine? I saw the query running in Activity Monitor a couple times in SLEEP_WAIT mode, but not blocked by anything...
EDIT2: The connection string is:
Data Source=SERVERNAME;Initial Catalog=DBName
Is it definitely the query taking a long time to run, or is the processing being done by the server that is slow? Some reports call queries multiple times. For instance, if you have a subreport inside a of a paging list control, each page of that report calls the query separately. So maybe there's something the report is doing with the data causing the delay?
How large is the data set that is returned by your query? If it is very large the majority of the time that is taken on the report server could be related to the time it takes the report to render. To be sure you could look at the ExecutionLog table on the report server to see if the TimeRendering is a large number in comparison to the overall execution time.
I think that this is not uncommon, but we looked into similar issues.
From memory, one thing that we did notice was that our subreport had parameters, and we've configured the "possible values" to be queried from the database.
I think that every time the subreport runs, SSRS re-queries the possible values of the parameters (& runs any other queries in your report even if you don't use the results).
In this case, once we were happy the subreport was working OK, we removed the queries for vaidating the parameter values and allowed "any value", assuming the parent report would not feed us bad parameter values.
A tad late to the party, but for anybody from the future having a similar problem.
Parameter sniffing
If a stored procedure with parameters is being used, it might be due to a phenomenon called 'parameter sniffing'.
In short, the first time a stored procedure is executed from SSRS an execution plan, based on the specified parameter values, is determined. This execution plan is then stored and used every time the stored procedure is executed from SSRS. Even though this execution plan might not be optimal for any future parameter values.
For an excellent and more extensive explanation have a look at: https://www.brentozar.com/archive/2013/06/the-elephant-and-the-mouse-or-parameter-sniffing-in-sql-server/
Other questions
Also have a look at this similar question:
Fast query runs slow in SSRS