User`s guide

A stored procedure is a compiled SQL program, consisting of one or more SQL statements, which
resides and runs on your SQL server. Although stored procedures can take time to set up properly,
they can be incredibly powerful.
The advantages of using stored procedures are most noticeable when reporting off large sets of data,
or when running reports that demand long, complex calculations. In such cases, you should ideally use
a predefined stored procedure that performs the complex work for you on the database server.
Because stored procedures reside on your SQL server, you may need to ask your Administrator about
accessing or setting up a stored procedure.
For more information on stored procedures, see Stored procedures.
6.5 Using enhanced record selection formulas
The most important thing you can do to speed up report processing is to limit the amount of data that
is returned from the database. Your primary tool for doing this is the record selection formula.
Crystal Reports analyzes your record selection formula and generates an SQL query from it. This SQL
query is then processed by the database, which sends the resulting records back to Crystal Reports.
Crystal Reports then evaluates the record selection formula locally for each of the records retrieved
from the database, thereby calculating the set of records used to generate the report.
Unnecessary records are eliminated at two stages: at the database with the SQL query and within
Crystal Reports by the record selection formula. For speed, you want as many records as possible to
be eliminated in the first stage. By designing your record selection formula effectively, you can off-load
much of the processing to the database server, thus eliminating unnecessary records before returning
them to Crystal Reports. This is commonly called "pushing record selection down to the database
server."
This section offers several tips to ensure that your record selection formulas can be pushed down to
the database server.
6.5.1 Pushing down record selectionan example
This example demonstrates the benefits of writing record selection formulas that can be pushed down
to the database server.
In the Orders table of the Xtreme sample database, there are 2192 records, of which 181 have order
dates prior to 2001. Suppose you want to report on only those records. On the one hand, you could
use this record selection formula:
Year ({Orders.Order Date}) < 2001
2012-03-14119
Designing Optimized Web Reports