Hitachi

Hitachi Advanced Database Application Development Guide


5.11 Equivalent exchange of search conditions

HADB might convert a specified search condition so that the search condition can be evaluated more efficiently. This is called equivalent exchange of search conditions. When equivalent exchange is performed on search conditions, the indexes to be used during retrieval are determined based on the search conditions obtained after equivalent exchange has been applied. For details about the method for determining the index to be used during retrieval, see 5.2 B-tree indexes and text indexes used during execution of SQL statements and 5.3 Range indexes used during execution of SQL statements.

HADB performs equivalent exchange in the following order for the conditions specified in search conditions:

  1. Equivalent exchange for OR conditions (removing from the OR conditions)#

    This is an equivalent exchange that removes a condition from the inside of an OR condition to the outside of the OR condition.

  2. Equivalent exchange for OR conditions (converting to IN conditions)#

    This is an equivalent exchange that adds an IN condition created from an = condition in an OR condition to the outside of the OR condition.

  3. Equivalent exchange for OR conditions (equivalent exchange to derived tables for which the UNION ALL set operation is specified)#

    This is an equivalent exchange from a search condition inside an OR condition to a derived table for which the UNION ALL set operation is specified.

  4. Equivalent exchange for scalar operations

    This is an equivalent exchange that transposes scalar operations.

  5. Equivalent exchange for an IN predicate

    This is an equivalent exchange from an IN predicate to the = conditions or <> conditions.

  6. Equivalent exchange for a HAVING clause (converting to the WHERE clauses)

    This is an equivalent exchange from the search condition for a HAVING clause to the search condition for a WHERE clause.

  7. Equivalent exchange for search conditions in SQL statements that specify derived queries (transposition to the WHERE clause of a derived query)

    This is an equivalent exchange that moves the search condition specified in the WHERE clause of an SQL statement in which a derived query is specified to the WHERE clause of the derived query.

#

The target of this equivalent exchange is the search condition in the WHERE clause.

The following subsections explain each of these types of equivalent exchange.

Organization of this section