Solved

Crystal Report Record Selection - best practice for order of statements for performance?

Posted on 2009-04-08
4
317 Views
Last Modified: 2012-06-27
Is there a certain order that Record Selection statements (that may be the wrong term, but I refer to the portions between AND and OR usually in my case).

Should you start by using a field that is Primary Keyed/Indexed and work your way down (so that as it hits each part it is looking at fewer records)?  Or does it not matter in the greater scheme of things?
0
Comment
Question by:uwhc
  • 2
4 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 125 total points
ID: 24101871
It matters in some cases.

If you are using ANDs then I would use the field that would fail the most often first since the other cruteria wouldn't get evaluated.  The opposite for ORs.

There is one caveat.  If a field can be NULL you need to test that first since Crystal will stop execution if it tries to compare a NULL field to a value

mlmcc
0
 
LVL 34

Assisted Solution

by:James0628
James0628 earned 125 total points
ID: 24103756
If you want to get really picky, there's also the question of how your tables are indexed.  If you're checking two fields and one is indexed and the other is not, you might want to check the indexed field first.  It's possible that something like that would be handled automatically somewhere along the line, but you could also try to arrange the tests yourself.

 James
0
 

Author Closing Comment

by:uwhc
ID: 31568262
Thanks for the info.
0
 
LVL 34

Expert Comment

by:James0628
ID: 24120403
You're welcome.

 James
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

856 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