Home > SQL Server Tips > Database Management and Administration > How to reuse datasets with Reporting Services
SQL Server Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

DATABASE MANAGEMENT AND ADMINISTRATION

How to reuse datasets with Reporting Services


Serdar Yegulalp, Contributor
02.21.2006
Rating: --- (out of 5)


Expert advice on database administration
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


When you run a report in Reporting Services, the dataset created for that report is created, used and then discarded. If you're running the same report many times against the same dataset for different departments or users, that dataset is recreated and destroyed again and again. This is pointless, especially if it's a particularly long-running report, which can tie up server resources and bring operations to a grinding crawl.

One of the tricks that I've learned as a SQL programmer is that any large amount of data that is being constantly recreated should be created once and held until it's been rendered obsolete. The best way to do this is to create a stored procedure that's used to collate the needed data, store it in a table and then provide the data from that table when necessary. Whenever the stored procedure runs in the future, it checks the table to see if the needed data is there and up-to-date; if it is, it simply provides that static data instead of recreating everything from scratch.

For datasets that are in the tens of thousands of rows or greater, this can be a good way to optimize back-end processing and avoid redoing the same work. The exact way to do this varies enormously depending on the kind of data you needed to obtain, but a typical stored procedure written in this fashion might work as follows:

    1. Check to see if there is existing data that matches the needs of the user, based on any passed parameters. For instance, if you're dealing with a report that would be updated once a day, look for the most recent version of the report data, which would have some form of date stamp. (One way to speed this up is just to look for a single matching record by using SELECT TOP 1 or the SET ROWCOUNT command.)

    2. If there is no data that matches, or if the existing data is old, flush the existing data (if needed) and compile the new data to the table in question, all in the context of a transaction.

    3. Return the compiled data as the result of the stored procedure.

    4. Uses the returned dataset to format the report.

As ...


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google



RELATED CONTENT
Database Management and Administration
Password cracking tools for SQL Server
Using traces in SQL Server Profiler
Meet compliance requirements with improved database security practices
Hardening the network and OS for SQL Server security
Securing the server and database in SQL Server
How SQL Server 2008 components impact SharePoint implementations
Troubleshooting Distributed Transaction Coordinator errors in SQL Server
Achieving high availability and disaster recovery with SharePoint databases
Clearing the Windows page file and its effect on server performance
Deploying a SQL Server virtual appliance for Microsoft Hyper-V

SQL Server Business Intelligence (BI) and Data Warehousing
Programming report generation with SQL Server Reporting Services 2008
Using the Pivot transformation in SQL Server Integration Services
DBA career paths could lead to business intelligence
Are data warehouses made for the cloud?
Q&A: Business intelligence gets a facelift in SQL Server 2008 R2
Project Gemini gets a new name, Madison earns buzz
Speed up reports in SQL Server Reporting Services with caching
Data Transformation Services vs. SSIS: The key differences
Using package configurations in SQL Server Integration Services (SSIS)
How SQL Server 2008 components impact SharePoint implementations

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
data aggregation  (SearchSQLServer.com)
data preprocessing  (SearchSQLServer.com)
data warehouse  (SearchSQLServer.com)
FileMaker  (SearchSQLServer.com)
GIS  (SearchSQLServer.com)
MOLAP  (SearchSQLServer.com)
pivot table  (SearchSQLServer.com)
Quiz: SQL Server 2000  (SearchSQLServer.com)
SQL  (SearchSQLServer.com)
T-SQL  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


you can guess, returning static data from a table (especially if you use NOLOCK or other read-acceleration mechanisms) is much faster than compiling it anew from a query. This approach might not work for all queries -- for instance, queries that involve sophisticated multiple joins or child reports might not be written easily to a flat table -- but it's an approach worth keeping in mind.

About the author: Serdar Yegulalp is editor of the Windows Power Users Newsletter. Check it out for the latest advice and musings on the world of Windows network administrators -- and please share your thoughts as well!


More information from SearchSQLServer.com

  • Tip: Speed CSV imports into Excel
  • Book Excerpt: Installing and configuring Reporting Services
  • Tip: Unreadable snapshots in Reporting Services


  • Rate this Tip
    To rate tips, you must be a member of SearchSQLServer.com.
    Register now to start rating these tips. Log in if you are already a member.


    Submit a Tip




    DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



    SQL Server Development - .NET, C#, T-SQL, Visual Basic
    HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
    About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
    SEARCH 
    TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

    TechTarget Corporate Web Site  |  Media Kits  |  Site Map




    All Rights Reserved, Copyright 2005 - 2009, TechTarget | Read our Privacy Policy
      TechTarget - The IT Media ROI Experts