Your queries will run more efficiently if you consider the following suggestions when you build your queries.
Key Usage
Keys minimize processing. Therefore, you can build keys to improve Compound Boolean Selection Facility performance.
When the predicates of a query uses keys, Compound Boolean Selection Facility can use the CA Datacom/DB index to evaluate the predicates more efficiently and can avoid having to access data rows. When the predicates includes no keys, Compound Boolean Selection Facility must examine the data rows in the table to evaluate the predicate.
Predicate Structure
Use predicates that can be easily converted to Compound Boolean Selection Facility format. There are predicates that are difficult or impossible to convert to Compound Boolean Selection Facility format. These are handled by CA Dataquery. The predicates that are not passed to the Compound Boolean Selection Facility are:
When a predicate that cannot be converted to Compound Boolean Selection Facility format is ANDed to a predicate that can be converted, the predicate that can be converted is passed to Compound Boolean Selection Facility. The predicate that cannot be converted is processed by CA Dataquery and then the results from Compound Boolean Selection Facility and CA Dataquery are ANDed.
When the predicates are ORed, if any predicate cannot be processed by the Compound Boolean Selection Facility, none of the ORed predicates can be processed by the Compound Boolean Selection Facility.
A FIND statement has three predicates: P1, P2, and P3. P3 cannot be converted to Compound Boolean Selection Facility format.
In this case, since there are no ORs, P1 and P2 are passed to the Compound Boolean Selection Facility and P3 is then applied to the result set.
In this case, P2 cannot be processed by Compound Boolean Selection Facility along with P3 since they are ORed, so only P1 is passed to the Compound Boolean Selection Facility. The condition P2 OR P3 is then applied to the result set from Compound Boolean Selection Facility.
Join Column Selection
When two tables are related in a query, they are normally joined by columns or keys in the two rows. When the search is performed, the link column in the table searched secondly is used to create an additional key-value or column-value predicate using a value extracted from the link column of the first table. With CA Dataquery you can join tables when the link column is not a key in either table. This should be done with care because if there are no keyed criteria supplied for the table searched secondly in the relationship, repeated full table searches of that table can be required.
When multiple tables are related in a query, CA Dataquery does not necessarily search the tables in the order stated. Instead, it determines every possible way that the search can be done, dynamically estimates the cost of each, and selects the lowest cost estimate.
Important! The use of outer joins and disjoins in a query causes the CA Dataquery optimization process to be bypassed. CA Dataquery processes any query containing either an outer join or a disjoin keyword by accessing the database tables in the order they appear within the query. The use of OUTER-JOIN, RIGHT-JOIN, or RIGHT-DISJOIN adds additional time to the processing of the FIND statement since CA Dataquery must read each table named on the "right side" twice to accomplish the join. The use of LEFT-JOIN or LEFT-DISJOIN does not cause this additional processing.
Usage Procedures
Establish procedures for users to follow to realize resource conservation:
For example, this can be done by specifying FIND 20 ROWS instead of FIND ALL ROWS.
|
Copyright © 2014 CA.
All rights reserved.
|
|