Crystal Performance - Stored Procedures vs Datasets

Posted on 2006-06-08
Last Modified: 2008-02-01
We have a web application that produces PDF formated reports.
Currently we use .NET datasets to pass the data into Crystal reports in real time.
These can be large and some reports take sveral hours to run (1500+ records) where there are multiple subreports embedded. At time it crashes the server altogether, chewing up resources.
We are trying to come up with a way to delay the report running to a time where server usage is low eg; (9pm)
If I use stored procedures as the datasources in my reports, and pass the parameters out of a database (where they are stored until time allows the report to be run) does this create performance issues. One report may access 5 stored procedures for each record... therefore 7500 calls on a large report.

I want to know if this is faster, slower...or a stupid way of addressing our issue.
Any input is appreciated...though please dont give generic links to examples.
Question by:Milkus1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +2
LVL 10

Assisted Solution

Spykair earned 50 total points
ID: 16867535
>One report may access 5 stored procedures for each record... therefore 7500 calls on a large report.
I know that a report can only have one SP as a datasource. I assume that the other 4 SP's are called from subreports. Subreports will definitely have an influence on the performance of your report. The more subreports you have, the slower your report will run.

LVL 42

Accepted Solution

frodoman earned 350 total points
ID: 16869512
It sounds like you're calling multiple subreports for each record on your report, is that correct?  If so, then I don't think you'll see any performance gain by moving to stored procedures (it might even slow down a little because of the initialization time).

With a report structured this way, almost certainly the bulk of the time is within Crystal itself so changing the datasource isn't going to have a significant impact.  If you really want to boost performance, look for a way that you can eliminate some of the subreports.  One suggestion to look at would be if you can return some of the data being pulled in the subreports with your main dataset (this is where a stored procedure might help by enabling you to do this).  Although this often means some duplicate data gets sent in, it may be much more efficient than 7500 subreport calls.

LVL 26

Assisted Solution

by:Kurt Reinhardt
Kurt Reinhardt earned 50 total points
ID: 16870909
frodoman and spykair offer good advice.  Subreports can be useful, but they can also be very detrimental.  For example, a subreport makes a call to the database once for every occurence of the section in which it is housed.  For example, if a subreport is in the Report Header, it will make one call to the db.  If it is in the Page Header, it will make one pass for every page in the report.  If it is in the detail section, then it will make one pass for every detail record returned - if there are 50,000 records returned, it will make 50,000 passes to the database.  Obviously, this isn't ideal.

Before you consider changing from a .NET dataset to a stored procedure, I would suggest you analyze the actual report requirements and design and see if there's a better way to gather and return the data.  As frodoman stated, stored procedures can help to eliminate the need for subreports.  Additionally, if you simply need to return a single value and you're using a subreport to get it, a SQL Expression field might help.

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

LVL 101

Assisted Solution

mlmcc earned 50 total points
ID: 16874645
Agree.  The report will probably run better if run when the server has less load but it will still use similar amounts of resources it just won't be competing for them.

The stored procedure should run fatser since but as pointed out by frodoman, the gain will be outweighed by the complexity of the report and the number of calls.


Author Comment

ID: 16883387
All good advice, thankyou. Point splitting looks likely ;0)

If it helps the report produces a list of applicants for a particular hospital for various positions.
So the report is grouped by 'Position' and inside each applicant's details is subreports for

1.List of qualifications (0...5 records)
2. List of previous employment (0...10 records)
3. List of preferences for positions (1-5 records)
4. List of referees (3 records)
5. List of referee replies (3 records)

These are also accompanied by up to 100 other fields eg : surname, DOB, etc

What would be the recommended approach, based on the fact there may be 1500+ applicants.

LVL 42

Expert Comment

ID: 16884703
It's difficult to say the 'best' approach w/out being in your shoes.  One thing I would consider doing is to make all of the applicant's details a single subreport.  Create a stored procedure that returns for every employee a single record structured like this:

Qualification1, Qualification2, Qualification3, Qualification4, Qualification5, PrevEmploy1, PrevEmploy2, ... etc.

Have your SP return empty strings or even a single space character for any field w/out data so you're always getting back the same fields, even if nothing is in them.  You can then layout your subreport with a very large details section and arrange all of these fields however you want to see them.  This gives you all of the same data but only 1 subreport per employee - as long as the SP is efficient this will be a tremendous improvement.

You might also consider making this subreport "on-demand" so it only runs if you're interested in this person and click on their name.  I don't know though if that makes sense for your situation.


LVL 101

Expert Comment

ID: 16938815
Glad i could help

LVL 10

Expert Comment

ID: 16939762
Glad to help.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question