Look ahead predicate generation (LPG)

 

A special type of transitive closure called look ahead predicate generation (LPG) may be costed for joins. In this case, the optimizer attempts to minimize the random I/O costs of a join by pre-applying the results of the query to a large fact table. LPG will typically be used with a class of queries referred to as star join queries, however it can possibly be used with any join query.

Look at the following query:

SELECT * FROM EMPLOYEE,EMP_ACT 	WHERE EMPLOYEE.EMPNO = EMP_ACT.EMPNO 	AND EMPLOYEE.EMPNO ='000010'

The optimizer may decide to internally modify the query to be:

WITH HT AS (SELECT *
		FROM EMPLOYEE 		WHERE EMPLOYEE.EMPNO='000010')


SELECT * FROM HT, EMP_ACT WHERE HT.EMPNO = EMP_ACT.EMPNO AND EMP_ACT.EMPNO IN (SELECT DISTINCT EMPNO FROM HT)

The optimizer places the results of the "subquery" into a temporary hash table. The hash table of the subquery can be applied in one of two methods against the EMP_ACT (fact) table:

LPG processing is part of the normal processing in the SQL Query Engine. Classic Query Engine only considers the first method, requires that the index in question by an EVI and also requires use of the STAR_JOIN and FORCE_JOIN_ORDER QAQQINI options.

 

Parent topic:

Join optimization

 

Related reference


Control queries dynamically with the query options file QAQQINI