Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-04-08
4
Medium Priority
?
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 375 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 35

Assisted Solution

by:James0628
James0628 earned 375 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 35

Expert Comment

by:James0628
ID: 24120403
You're welcome.

 James
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

604 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