Solved

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

Posted on 2009-04-08
4
289 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

760 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now