HPlogo ALLBASE/SQL Performance and Monitoring Guidelines: HP 9000 Computer Systems > Chapter 3 Guidelines on Query Design

Avoiding User Propagation of Filters

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

A filter is an element in a predicate that reduces the size of the query result by eliminating a category of result rows. Consider the following join query fragment:

... WHERE table1.col1 = table2.col2

    AND table1.col1 <= 200

Note that, logically, table2.col2 has to be <= 200 as well; that is, it is subject to the same filter as table1.col1. ALLBASE/SQL propagates such filters from one joined table to the other joined tables without your explicitly doing so. Thus the above query is translated internally into:

... WHERE table1.col1 = table2.col2

    AND table1.col1 <= 200

    AND table2.col2 <= 200

This internal translation is done for all equal-joins on multiple tables. Both range predicates (<, <=, >, >=) and the equals predicate (=) are propagated. The result is a performance improvement on equal-joined queries when there are one or more range or equal predicate filters on one or more of the tables.

Since the optimizer does not check for duplicates in filters, you should not explicitly propagate filters in writing the queries. If you do, SQLCore processes the same filter twice. This causes performance to deteriorate without adding anything significant.

Feedback to webmaster