Using join indexes

A natural join between the id columns of sales_order and sales_order_items makes more sense. In this case, the columns with the same name should contain matching values. The command to create a join index based on a natural join between these two tables is:

CREATE JOIN INDEX sales_order_so_items_join FOR sales_order NATURAL FULL OUTER JOIN sales_order_items

Creating a join index in Sybase Central

To create a join index in Sybase Central, follow these steps.

To add a join index in Sybase Central:

1Select the Join Indexes folder in the left panel of the Sybase Central window.

2Double-click the Add Join Index object in the right panel to open the Join Index editor.

3Highlight <Unnamed> in the Name box and enter a name for the index.

4From the Left Table Name dropdown, select a table name. Repeat for the Right Table Name.

5Select a Join Type from the dropdown. If you select a type other than Natural, specify the Join Columns.

6Click Advanced Properties to add a comment.

7If you are only joining two tables, click Save and Commit.

8To join more than two tables, click Add Row. In the new row that appears, enter the next table to join in the Right Table Name column. Then click Save and Commit.

Types of join hierarchies

Adaptive Server IQ supports two different types of join hierarchies:

Linear joins

Star joins

You create join indexes or ad hoc joins for both linear and star joins.

164

Page 184
Image 184
Sybase 12.4.2 manual Creating a join index in Sybase Central, Types of join hierarchies, 164