Multiple Database hits for same datasource

4 posts, 1 answers
  1. Hendrik
    Hendrik avatar
    2 posts
    Member since:
    Jan 2016

    Posted 20 Jan Link to this post

    I have a report that needs to be generated in large quantities and sent to clients, so performance is of utmost necessity.

    I've realized by monitoring SQL Server Profiler that all the available parameter values are queried twice, causing a few milliseconds of time wasted. 

    This however is not as serious as the fact that the main datasource queries are run twice as well. These cause quite a performance hit when generating reports.
    After some investigation it seems that one of the tables referencing the datasource in the report is what is causing the repeat query. I find this strange since none of the subreports that use the same datasource cause the same behaviour.

    The datasource value of the table is set to my maindatasource and no additional calculation is done on the data. The table literally just displays field values directly from the datasource

     Why is my database getting hit more than once to retrieve exactly the same data?

    The datasource is of type Telerik.Reporting.ObjectDataSource and I'm using 2015 Q3  

  2. Answer
    Katia
    Admin
    Katia avatar
    299 posts

    Posted 21 Jan Link to this post

    Hello Hendrik,

    Most common reason for this behavior is that DataSource property is set to the same database for both Table item and Table's parent item (Report). As it is a common requirement that the data needed for your Table or another data item will already be present in the parent's data source, in this case you can improve the report performance by reusing the data from the parent, instead of creating and configuring a new data source component to retrieve the data anew. You can reuse the data by adding a Binding to the data item's DataSource property, which sets the following expression: = ReportItem.DataObject.

    For more information, please refer to the Binding a Data item to Data and How to use the ReportItem.DataObject property in expressions help articles.

    If the above information does not help, please open a support ticket and attach a runnable demo project that reproduces this issue. This way we can check your settings and give you more accurate suggestions.

    Regards,
    Katia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Hendrik
    Hendrik avatar
    2 posts
    Member since:
    Jan 2016

    Posted 22 Jan in reply to Katia Link to this post

    Thank you for the reply Katia.

    This binding approach does work when there is a report data source set, but in my case I did not have a report data source. 
    After some restructuring on the various tables and subreports using this datasource, I was able to use one report data source and bind all the tables to that source. 

    Great article references.

  5. Katia
    Admin
    Katia avatar
    299 posts

    Posted 22 Jan Link to this post

    Hi Hendrik,

    It is nice to hear that the problem was resolved.

    In general, the number of executed queries depends on how many data items with their own data sources appear in the report at its processing stage.

    Some advice on how to optimize the performance of the report is also provided in Performance Considerations article.


    Regards,
    Katia
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top