{startwiththistable}

This keyword provides a hint CONNX to start with a specific table in a query plan.  The hint may not be honored, depending on available query plans.

 

Example:

select * from customers_rms c, orders_rms {startwiththistable} o, products_rms p where p.productid = o.productid and c.customerid = o.customerid

 

CONNX determines an execution plan based on the various tables/fields that are used. To view the execution plan for a query, the extended CONNX function {statistics} can be placed after the query. The results that are returned are the query plan.

 

image44.gif
 

In this example, two indexes are used. CONNX determines that ORDERS_RMS is to be used as the  starting table because of the use of an index in the query (ordered=1).

In most cases, CONNX selects the most efficient plan. However, the user can force the choice of the starting table by using the extended function {startwiththistable}.

 

Example:

select * from customers_rms c  {startwiththistable} , orders_rms  o , products_rms p   where

p.productid = o.productid and c.customerid = o.customerid  and orderid=1 and c.customerid='MERRG' {statistics}

This query produces the following query plan:

image45.gif