Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

770 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