The INDEXSELECTIVITY=
option enables you to tune the SQL join planner strategy for more
efficient or robust index join methods. The INDEXSELECTIVITY= setting
is a continuous value in the range 0–1 that acts as a minimum
threshold value for the SPD Server cardinality ratio when selecting
a join method. The SPD Server cardinality ratio is a heuristic that
acts as a measure of the cardinality of the inner table index, relative
to the frequency of index values as they occur in the outer table.
Both INDEXSELECTIVITY= and the SPD Server cardinality ratio are continuous
values between 0 and 1. SPD Server compares the calculated cardinality
ratio for an SPD Server index join to the value that you specify in
the INDEXSELECTIVITY= option. If the calculated cardinality ratio
is greater than or equal to the value that is specified in the INDEXSELECTIVITY=
option, SPD server chooses the index join method. The default setting
for the INDEXSELECTIVITY= option is 0.7.
How does SPD Server
calculate the cardinality ratio? The cardinality ratio of an indexed
column is calculated as the number of unique values in the index column,
divided by the number of rows in the outer table. As the value of
the cardinality ratio approaches 0, which indicates low cardinality,
the greater the number of duplicate values that exist in the rows
of the outer table. As the value of the cardinality ratio approaches
1, which indicates high cardinality, the fewer the number of duplicate
index values in the rows of the outer table. For example, a cardinality
ratio of 1/1, or 1, represents a unique index value for every row
in the outer table, a unique index. A cardinality ratio value of 1/2,
or 0.5, represents a unique index value for every two rows in the
outer table. A cardinality ratio value of 1/4, or 0.25, represents
a unique index value for every four rows in the outer table. The default
setting of INDEXSELECTIVITY= is 0.7, which represents a unique index
value for every 1.43 rows in the outer table.
For example, consider
an outer table that contains 100 rows that match join key values in
the inner table, and a calculated SPD Server cardinality ratio of
0.7 (a unique index value per 1.43 rows in the outer table). The expected
result set is 100*1.43, or 143 rows.
Higher cardinality and
higher index cardinality ratios are associated with an efficient index
join. Cardinality ratios near 1 result in more efficient processing
during probes between the outer table rows and the inner table index,
because each probe has fewer rows to retrieve. In turn, the work that
the SPD Server index must do to find and retrieve the matching rows
during the join operation is maximized, which results in an optimized
index join.
You can use INDEXSELECTIVITY=
to configure the index join to be more or less tightly constrained
by the number of duplicate values in the join table rows. Increasing
the value of INDEXSELECTIVITY= makes the cardinality criteria more
selective by decreasing the allowable average number of rows per probe
of the inner table. Setting INDEXSELECTIVITY= equal to 1.0 allows
only a join with a unique index. Setting INDEXSELECTIVITY= to a value
greater than 1.0 allows no index joins. Decreasing the value of INDEXSELECTIVITY=
makes the cardinality criteria more flexible by increasing the allowable
average number of rows per probe of the inner table. Setting INDEXSELECTIVITY=
equal to 0.0 allows joins with any amount of cardinality.
Usage: execute(reset indexselectivity=<0.0 ... 1.0>)
by sasspds ;