Parameter | Description |
---|---|
eMode | Find Mode |
iOrder | Ordering (index) number |
Function DDOConstraintFindMeta Integer eMode Integer iOrder Returns tDDOConstraintFindMeta
Call: | Get DDOConstraintFindMeta eMode iOrder to tDDOConstraintFindMetaVariable |
tDDOConstraintFindMeta FindMeta Get DDOConstraintFindMeta of hoDD (GE) iIndex to FindMeta
Before a constrained find occurs for a specified index and find mode, the runtime determines what kind of optimizations can be applied for these constraints for this index. It does this by looking at every constraint in the array and determining if the resulting constrained find can be used for Jump-in (by seeding some of the segments), and which constraints are JumpOut (if the constraint fail, you are done), which constraints can be evaluated before the relate and which constraints are evaluated after the relate. DDOConstraintFindMeta returns this information for a particular index as a tDDOConstraintFindMeta struct type, which is defined as follows:
Struct tDDOConstraintFindMeta Integer iJumpInSegments Boolean bJumpOut Boolean bPreRelate Boolean bPostRelate End_Struct
iJumpSegments - This contains the number of segments that are filled in when find is initialized. In general, the more index segments that can be filled in, the more efficient the initial JumpIn find.
bJumpOut - This determines if there are any constraints in the array that, upon a failed evaluation, means there are no more valid records to be found. The find is complete. JumpOut constraints are evaluated first and if they fail, the find is over.
bPreRelate - This is True if any of the constraints in the array can be evaluated after the record find but before the relate. If a PreRelate constraint fails, you will not need to perform an unneeded relate for that one find. PreRelate evaluations occur after the JumpIn evaluation. If they fail, you must still keep searching for a valid record.
bPostRelate - This is True if any of the constraints in the array must be evaluated after the relate. PostRelate requires that a relate must occur before you can be sure that a record is valid. The overhead of relates may be significant if you need to find and test a large number of records before a valid record is found.
When a find occurs, the constraints the JumpOut constraints are tested first. If they fail, the find is over. Next, PreRelate constraints are tested. If they fail, no relate occurs but you will keep finding records. Next, a relate will occur and the constraints that must be tested PostRelate will be tested. If this fails, the finding will continue.
One thing to note about PostRelate constraints is that inherited constraints almost always require PostRelate tests. If you do not need inherited constraints, shut them off (Set pbInheritConstraints to False). 'Constrain As' constraints always require PostRelate tests. The runtime has no idea what is in the expression and therefore requires a constraint before the test.
This is very technical information and is probably going to be most useful when debugging and profiling. The Data Dictionary Inspector (DD_Debug.pkg) provides all of this information to you. If you want to see how this can be used, study the code and the results in dd_debug.dg. Remember that the efficiency of a constraint is determined by the index used. You can use dd_debug.dg to see which indexes support JumpIn and JumpOut and which indexes require PostRelate evaluations.