Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Data Collection Performance Post Reply Post New Topic
Author Message
sch9009
Newbie
Newbie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 8
Quote sch9009 Replybullet Topic: Data Collection Performance
     Posted: 18 Apr 2014 at 3:38am
I have a massive / complex report to calculate daily ordering average for a warehouse.  This thing has three subreports to allow the sharing and summary of various shared variables.
 
Anwyays, the subreports look at the purchase history and requisition history tables and they bring back the data based on a date range specified in the parameter (main report)..
 
However, the date range is only the previous 4 months up till today. 
 
So my questions is:  Is there anything I can do so the subreports don't shift through the previous 10 years of purchasing data and only looks at data greater than 2013?  Essentially, looking to see if I can speed up the report by having crystal ignore everything up till 2013?  make sense?
 
let me know if there is anything else I can do to help better explain.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 18 Apr 2014 at 5:15am
you could write a stored procedure and have the subreport use that. Otherwise, if you are joining directly to the table and using a record selection formula, CR is generating a sql command that incorporates the parameters...so it isn't reading all the data either.

The 'biggest' gains would probably be achieved by making the whole a stored proc and calculating the values that the subreports return.

Why?

Because every time a subreport is called a new connection to the database is opened and the data is read from the tables.

So the standard example is: if you have a report with 100 rows of details and each detail has a subreport, then the report will connect and read from the database 101 times.

If you got all the information that you needed the first time, then the number reads would be 1...a big time saver.

I do know that this solution is not for everybody based on some shops not allowing stored procedures to be written and/or no not knowing how to write a procedure.

With that in mind, this would be the biggest speedup. Specialized views or optimized procs would be the other way to go.

As you can probably tell, I try to avoid subreports if at all possible, because of their performance hits.

Edited by lockwelle - 18 Apr 2014 at 5:16am
IP IP Logged
sch9009
Newbie
Newbie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 8
Quote sch9009 Replybullet Posted: 21 Apr 2014 at 8:37am
Thanks! I agree that stored procedure would be best as well.  However, I am not the DBA, so I don't have access to create one and the DBA here takes forever for the tiniest requests.
 
Maybe creating a MS Access connection and recreating my own queries, and bringing that back over to crystal will do for now.
 
Either that or try building the report with a tone of LEFT outter joins. 
IP IP Logged
hello
Groupie
Groupie
Avatar

Joined: 05 Feb 2014
Online Status: Offline
Posts: 85
Quote hello Replybullet Posted: 23 Apr 2014 at 9:38am
What about using the add command feature to create an SQL statement to filter out unwanted data. It basically is a simple stored procedure that gets executed BEFORE any CR passes, right?
IP IP Logged
sch9009
Newbie
Newbie


Joined: 16 Feb 2011
Online Status: Offline
Posts: 8
Quote sch9009 Replybullet Posted: 23 Apr 2014 at 9:59am
I was wondering about that as well.  Should that reduce the impact on system performance?  I know the hardcore basics of crystal, but things like "add command" vs. "stored procedure" is something I don't know the details of...(i.e. performance impact difference)
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 23 Apr 2014 at 10:26am
it should be quicker, as long as you replace the subreport with the data from the command...
I like stored procedures because of the versatility, much of which revolves around temp tables and being able to tailor the result set...
There are reports that are simplified if not totally impossible to achieve without a stored proc.

Again, it depends on what data you can extract using the command and how you combine it...and getting rid of the subreports (I guess that is really the key)
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum