[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: How indexes used with search



Roman Rybalko wrote:
I'd like to understand how indexes are used with search.
I've found some info
http://www.openldap.org/doc/admin24/tuning.html#Understanding how a search
works
<http://www.openldap.org/doc/admin24/tuning.html#Understanding%20how%20a%20search%20works>
but that's not very precise.

Suppose there is a search like (&(attr1=value1)(attr2=value2)), attr1 and
attr2 are indexed.
As far as I understand, this search fetches objectIDs from the index on attr1,
than the objectIDs from the index on attr2, than, according to operation "and"
("&"), objectIDs that present in BOTH sets are determined (using some
set-intersection algorithm).
When the search is "or" (|(...)(...)), the objectIDs from both sets are joined
and duplicates are removed (using some set-union algorithm).
If there is no index on attribute, the resulting objectID set is determined by
bare iterate-and-compare on all the objects, or so.
Am I right?

That's correct.

--
  -- Howard Chu
  CTO, Symas Corp.           http://www.symas.com
  Director, Highland Sun     http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP  http://www.openldap.org/project/