Physical Value Rationalization for Optimized Reads
Physical Value Rationalization for Optimized Reads
After determining the offset and length of the keys that result from the SQL query, the read process rationalizes the values for multiple columns into a single list of low and high value keys. This rationalization optimizes reading of the legacy data.
The process rationalizes physical values once for hard-coded SQL, and multiple times for lookups or parameterized Update and Delete SQL. The columns that comprise the key are processed one at a time until either the entire key has been processed or until one of its columns has no conditions.
To prepare for rationalization, PowerExchange evaluates both primary key and secondary key columns. During the evaluation, PowerExchange prioritizes the primary key column and performs the following operations:
Applies all acceptable conditions to the low and high values list.
If the primary key column has no acceptable conditions, ends the evaluation. Processing then continues without optimized reading.
Primary key columns can include LE, LT, GE, and GT conditions that have negative numbers.
The evaluation performs on of the following operations for secondary key columns:
Extracts the minimum and maximum values and appends them to the appropriate location in the final values list that is used for optimized reading.
If a secondary key column has no acceptable conditions, pads the remainder of the physical values with binary zeros or X'FF'. The evaluation ends, and the rationalization process continues.
Secondary key columns cannot include LE, LT, GE, and GT conditions that have negative numbers.
The rationalization process performs the following operations:
Converts internal format values to physical format values that reflect the legacy data. For example, a NUM32 integer occupies 4 bytes.
Moves value pairs into a list sorted by binary sequence or numeric sequence. The rationalization uses numeric sequence if the primary column in the key is numeric, and the column type supports negative numbers.
Where only one of the boundaries have been set for LE, LT, GE, and GT conditions, inserts the missing low or high condition, usually by using binary zeros or X'FF'.
Creates the final physical values list by merging the lists for the primary key column and the secondary key columns.
The rationalization process creates the final list for optimized reading by performing the following operations:
Processes all columns comprising the key in sequence.
Copies all of the values for the primary column to the physical list.
For secondary columns, copies and appends only the low- and high-limit values to the appropriate location in the physical key
Ends processing if a secondary column has no acceptable conditions.
Ends processing when all columns in the key have been processed.