Un-chugging Crystal Reports for Optimal Performance
Cathy Michitsch, CRCP President, Michitsch Systems Inc. [email protected]
Topics
Database issues Multi-pass reporting Miscellaneous tidbits
Slide 2
Topics
Database issues
Indexed fields Table linking Grouping on server Pushing record selections to the server SQL expressions SQL commands
Multi-pass reporting Miscellaneous tidbits
Slide 3
Database Issues Indexed Fields
Table A contains 26 records Table B contains 2600 records
100 matching records for every record in Table A
1/4
Find two specific records in Table A and the 200 records (100+100) in Table B Crystal Reports should only have to read about 200 records in total
Slide 4
Database Issues Indexed Fields
2/4
Does your primary report include a record selection formula that sets range limits on the key (Indexed) field in Table A? Index A is Table A field indexed? Index B is Table B field indexed? How many records does Crystal Reports have to read out of Table A to find the two records in Table B?
Slide 5
Database Issues Indexed Fields
Are your selection formula fields indexed?
3/4
Slide 6
Database Issues Indexed Fields
Are your tables linked on indexed fields?
4/4
Slide 7
Database Issues Table Linking
Ensuring you are using the right join type Using the various join enforcement options can ensure that linked tables are included in the SQL query, even when none of the fields in the table are used in the report. (New in version 10)
Slide 8
Database Issues Grouping on the Server
Server-side processing let the server do the work
Less time connected to the server Less memory needed to process the report on your PC Lower transfer time from the server to the client
1/3
Slide 9
Database Issues Grouping on the Server
1. 2. 3. 4. Use SQL data sources Perform Grouping on Server option is checked on Use some form of grouping The report is at least partially hidden
At minimum, the Details section must be hidden
2/3
5. Do not group on a formula field, or use a formula in a summary field
Use SQL expressions as an alternative to formulas
6. Running totals must be based on summary fields only 7. No average or distinct count summaries 8. No specified grouping
Slide 10
Database Issues Grouping on the Server
3/3
1. Review the Report Performance Information Dialog Box to confirm Grouping on the Server is working
Slide 11
Database Issues Pushing Record Selections
Be careful when trying to do a record selection on a formula!
1/2
Slide 12
Database Issues Pushing Record Selections
Using an absolute value instead of a formula
2/2
Slide 13
Database Issues SQL Expressions
Using a formula in your record selection
1/2
Do not base your record selection on a formula!
No WHERE clause therefore the server is not doing the work!
Slide 14
Database Issues SQL Expressions
Using a SQL expression in your record selection formula
2/2
Slide 15
Database Issues SQL Commands
1/5
Pick Add Command once you pick your database connection
Slide 16
Database Issues SQL Commands
Sample SQL command including a parameter
2/5
Slide 17
Database Issues SQL Commands
Sample SQL command parameter
3/5
Slide 18
Database Issues SQL Commands
Changing the name of a SQL command
4/5
To change the command name, hold the left mouse button down on the name. Release to change the name.
Slide 19
Database Issues SQL Commands
How the SQL command data shows in Crystal Reports
5/5
Slide 20
Topics
Database issues Multi-pass reporting flow chart
Performance consideration goal Using arrays instead of sub-reports Manual running totals and manual distinct counts Page N of M
Miscellaneous tidbits
Slide 21
Multi-Pass Reporting Flow Chart
Crystal Reports XI
Slide 22
Performance Consideration Goal
The smaller the number of reporting passes, the faster your report processes Do you really need the Page N of M?
Avoid pass 3
Use on-demand sub-reports?
Pass 2 then only runs during drill-down
Can you avoid the subreports altogether?
Sometimes!
Is there another way to process Running Totals?
Yes .. using manual running total formulas
Review what data you are bringing into Crystal Reports
Can calculations be done prior to Crystal Reports?
Slide 23
Using Arrays Instead of Sub-reports
Need a list of records from another table?
1/2
Use an array to pull a list of volunteers assigned to one donor instead of a sub-report
Slide 24
Using Arrays Instead of Sub-reports
Array setup, display and reset formulas
2/2
Slide 25
Manual Running Totals and Distinct Counts
Manual running totals to replace Crystal Reports feature 1/2
1/6
Slide 26
Manual Running Totals and Distinct Counts
Manual running totals to replace Crystal Reports feature 2/2
2/6
Slide 27
Manual Running Totals and Distinct Counts
The actual running total formulas in Crystal Reports syntax
3/6
Slide 28
Manual Running Totals and Distinct Counts
Reset in the group header
4/6
Slide 29
Manual Running Totals and Distinct Counts
Using Crystal Reports distinct count summary feature
5/6
Slide 30
Manual Running Totals and Distinct Counts
6/6
Using a formula instead of the distinct count summary feature
Slide 31
Page N of M Pass 3
Only use the Page N of M if absolutely necessary!
Slide 32
Topics
Database issues Multi-Pass reporting flow chart
Performance consideration goal Using arrays instead of sub-reports Manual running totals and manual distinct counts Page N of M
Miscellaneous tidbits
Slide 33
Miscellaneous Tidbits
Text box versus concatenation formula
1/5
Slide 34
Miscellaneous Tidbits
Text box versus concatenation formula
2/5
Slide 35
Miscellaneous Tidbits
Create a group tree
3/5
Slide 36
Miscellaneous Tidbits
Building a group tree
4/5
Slide 37
Miscellaneous Tidbits
What else could cause your report to run slow? Considerations for when your report is running extremely slow on one computer but not on another
Check your ODBC drivers sometimes they get corrupted Options settings (SQL server / database options) CPU / RAM workstation hardware Review if other programs are running on that workstation (Task Manager) Network traffic Other database processes running at the same time NIC network card HUB / SWITCH network infrastructure Security issues
5/5
Slide 38