Solved

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

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

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 35

Expert Comment

by:James0628
ID: 24120403
You're welcome.

 James
0

Featured Post

Turn Insights Into Action

You’ve already invested in ITSM tools, chat applications, automation utilities, and more. Fortify these solutions with intelligent communications so you can drive business processes forward.

With xMatters, you'll never miss a beat.

Question has a verified solution.

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

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

717 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