Chapter 2. Improving the performance of views The performance of view-based hierarchies depends on the construction of the hierarchy itself and the number of entries in the directory tree (DIT). In general, there may be a marginal change in performance (within a few percentage points of equivalent searches on a standard DIT) if you use virtual DIT views. If you do not invoke a view in a search, then there is no performance impact. Test the virtual DIT views against expected search patterns and loads before deployment. Red Hat recommends indexing the attributes used in view filters if you intend to use the views as general-purpose navigation tools in the organization. Further, you can configure a virtual list view (VLV) index to be used in evaluation of sub-filters in views. There is no need to tune any other part of the directory specifically for views. 2.1. Creating indexes to improve the performance of views using the command line Views are derived from search results based on a given filter. Part of the filter are the attributes given explicitly in the nsViewFilter ; the rest of the filter is based on the entry hierarchy, looking for the entryid and parentid operational attributes of the actual entries included in the view. (|(parentid= search_base_id )(entryid= search_base_id ) If any of the searched attributes - entryid , parentid , or the attributes in the nsViewFilter - are not indexed, then the search becomes partially unindexed and Directory Server searches the entire directory tree for matching entries. To improve views performance, create the indexes as follows: Create equality index ( eq ) for entryid . The parentid attribute is indexed in the system index by default. If a filter in nsViewFilter tests presence ( attribute=* ), then create presence index ( pres ) for the attribute being tested. You should use this index type only with attributes that appear in a minority of directory entries. If a filter in nsViewFilter tests equality ( attribute=value ), create equality index ( eq ) for the attribute being tested. If a filter in nsViewFilter tests a substring ( attribute=value* ), create substring index ( sub ) for the attribute being tested. If a filter in nsViewFilter tests approximation ( attribute~=value ), create approximate index ( approximate ) for the attribute being tested. For example, when you use the following view filter: nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66)) you should index objectClass with the equality index , which is done by default, and roomNumber with the substring index . Prerequisites You are aware of the attributes that you use in a view filter. Procedure Optional: List the back ends to determine the database to index: # dsconf -D " cn=Directory Manager " instance_name backend suffix list dc=example,dc=com (userroot) Note the selected database name (in parentheses). Create index configuration with the dsconfig utility for the selected back-end database. Specify the attribute name, index type, and, optionally, matching rules to set collation order (OID), especially in case of an internationalized instance. # dsconf -D " cn=Directory Manager " instance_name backend index add --attr roomNumber --index-type sub userroot Repeat this step for each attribute used in the view filter. Reindex the database to apply the new indexes: # dsconf -D " cn=Directory Manager " instance_name backend index reindex userroot Verification Perform a search that is based on the standard directory tree with the same filter that you use in the view: # ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -b dc=example,dc=com (&(objectClass=inetOrgPerson)(roomNumber=*66)) # ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -b dc=example,dc=com " (&(objectClass=inetOrgPerson)(roomNumber=*66)) " View the access log in /var/log/dirsrv/slapd- instance_name /access . The RESULT of your search should not contain note=U or Partially Unindexed Filter in the details. Additional resources Managing indexes 2.2. Creating indexes to improve the performance of views using the web console Views are derived from search results based on a given filter. Part of the filter are the attributes given explicitly in the nsViewFilter ; the rest of the filter is based on the entry hierarchy, looking for the entryid and parentid operational attributes of the actual entries included in the view. (|(parentid= search_base_id )(entryid= search_base_id ) If any of the searched attributes - entryid , parentid , or the attributes in the nsViewFilter - are not indexed, then the search becomes partially unindexed and Directory Server searches the entire directory tree for matching entries. To improve views performance, create the indexes as follows: Create equality index ( eq ) for entryid . The parentid attribute is indexed in the system index by default. If a filter in nsViewFilter tests presence ( attribute=* ), then create presence index ( pres ) for the attribute being tested. You should use this index type only with attributes that appear in a minority of directory entries. If a filter in nsViewFilter tests equality ( attribute=value ), create equality index ( eq ) for the attribute being tested. If a filter in nsViewFilter tests a substring ( attribute=value* ), create substring index ( sub ) for the attribute being tested. If a filter in nsViewFilter tests approximation ( attribute~=value ), create approximate index ( approximate ) for the attribute being tested. For example, when you use the following view filter: nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66)) you should index objectClass with the equality index , which is done by default, and roomNumber with the substring index . Prerequisites You are logged in to the instance in the web console. You are aware of the attributes that you use in a view filter. Procedure Under Database , select a suffix from the configuration tree for which you want to create an index. Navigate to Indexes and Database Indexes . Click the Add Index button. Type the name of the attribute and select the attribute. Select the Index Types that should be created for this attribute. Optionally, add Matching Rules to specify collation order (OID), especially in case of an internationalized instance. Select Index attribute after creation to rebuild the index afterwards. Click Create Index . Repeat the steps for each attribute to be indexed. Verification Filter Indexes by typing the name of the added attribute. The newly indexed attribute should appear in the results. Additional resources Managing indexes

Commands:
(|(parentid= search_base_id )(entryid= search_base_id )
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))
dsconf -D " cn=Directory Manager " instance_name backend suffix list dc=example,dc=com (userroot)
dsconf -D " cn=Directory Manager " instance_name backend index add --attr roomNumber --index-type sub userroot
dsconf -D " cn=Directory Manager " instance_name backend index reindex userroot
ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -b dc=example,dc=com (&(objectClass=inetOrgPerson)(roomNumber=*66)) ldapsearch -D " cn=Directory Manager " -W -H ldap://server.example.com -x -b dc=example,dc=com " (&(objectClass=inetOrgPerson)(roomNumber=*66)) "
(|(parentid= search_base_id )(entryid= search_base_id )
nsViewFilter: (&(objectClass=inetOrgPerson)(roomNumber=*66))