DB2 selectivity
You can set the environment variables to influence the DB2® optimizer to make better choice about how to access data in the LDAP tables.
You can use the following environment variables to control the DB2 optimizer:
- LDAP_MAXCARD
= YES | ONCE | NO - You can use the LDAP_MAXCARD environment
variable to set the cardinality of the
LDAP_DESCtable. When you set this variable, a cardinality of9E18is assigned to theLDAP_DESCtable. The cardinality value influences the data access sequence of the DB2 optimizer. DB2 resolves all attribute filters before it considers theLDAP_DESCtable for query evaluation. - IBMSLAPD_USE_SELECTIVITY
= NO | YES - If the IBMSLAPD_USE_SELECTIVITY variable is
not set to any value or is set to
NO, selectivity is not used to influence DB2 access sequence.
You can improve the performance of subtree searches on search bases that are high in a directory tree by using SELECTIVITY in Structured Query Language (SQL). The inclusion of SELECTIVITY in SQL enables the DB2 optimizer in the formation of data access sequence to resolve the search requests. The data access sequence identifies which tables to access first during searches. Identifying the entries that are high in the tree (having many subentries) is based on DB2 statistics. If a subtree search is done by using one of these entries as the search base, the SELECTIVITY clause is added to the SQL query. When the SELECTIVITY clause is added, DB2 uses the search filter to narrow down the search results. DB2 narrows down the search results before it reads from the table that identifies the entries that are descendants of a base in a search.
To use SELECTIVITY, DB2_SELECTIVITY must be set
to YES in the DB2 registry
for the database instance. You must set DB2_SELECTIVITY in
addition to the environment variables. You can set DB2_SELECTIVITY when
you create a database instance.
Examples
- Example 1:
- To check the status of
DB2_SELECTIVITYfor a directory server instance, myinst1, run the following commands: - Example 2:
- To set
DB2_SELECTIVITYfor the directory server instance, myinst1, run the following commands: - Example 3:
- To set
DB2_SELECTIVITYin the configuration file of the directory server instance, myinst1, run the following commands:idsldapmodify -h host -p port -D adminDN -w adminPW dn: cn=Front End, cn=configuration changetype: modify add: ibm-slapdSetEnv ibm-slapdSetEnv: IBMSLAPD_USE_SELECTIVITY=YES