Using Ad Hoc Joins vs. Join Indexes

A join index is an internal structure that defines a relationship between the columns in two or more tables. Ad hoc joins are joins that do not use join indexes.

If you have defined join indexes on the join columns referenced in your query, Sybase IQ will usually use them to execute queries joining those tables. (For information about defining join indexes, see System Administration Guide: Volume 1 > Sybase IQ Indexes.)

Any join that does not use join indexes is known as an ad hoc join. If several tables are referenced by the query, and not all of them have join indexes defined, Sybase IQ will use the join indexes for those tables that have them in combination with an ad hoc join with the rest of the tables.

Because you cannot create join indexes for all possible joins, ad hoc joins may sometimes be necessary. Thanks to optimizations in Sybase IQ, you may find that queries perform as well or better without join indexes.

Keep these rules in mind when creating join indexes: