Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » SQL Anywhere Server - SQL Usage » Query Optimizer » Query optimization and execution » Reading execution plans » Reading text plans

 

Long text plan

The long text plan provides a little more information than the short text plan, and provides information in a way that is easy to print and view without scrolling.

In the following example, the first line of the long text plan is Plan[ Total Cost Estimate: 1.040539E-5 ] The word Plan indicates the start of a query block. The Total Cost Estimate is the optimizer estimated time, in milliseconds, for the execution of the plan. The plan indicates that the results are sorted, and that a Merge Join is used. On the same line as the join operator, there is either the word TRUE or the residual search condition and its selectivity estimate (which is evaluated for all the rows produced by the join operator). The HashFilter indicates that a hash filter is being built on the right-hand side of the Merge Join. The IndexScan lines indicate that the Customers and SalesOrders tables are accessed via indexes CustomersKey and FK_CustomerId_ID respectively.

SELECT PLAN ('SELECT GivenName, Surname, OrderDate, Region, Country
FROM Customers JOIN SalesOrders ON ( SalesOrders.CustomerID = Customers.ID )
WHERE CustomerID < 100 AND ( Region LIKE ''Eastern''
      OR Country LIKE ''Canada'' )
ORDER BY OrderDate');
( Plan [ Total Cost Estimate: 1.040539E-5 ] 
  ( WorkTable
    ( Sort
      ( MergeJoin [ ( ((Customers.Country LIKE 'Canada' : 100% Computed)
        AND (Customers.Country = 'Canada' : 7.936508209% Statistics)) 
        OR ((SalesOrders.Region LIKE 'Eastern' : 100% Computed) 
        AND (SalesOrders.Region = 'Eastern' : 5% Guess)) ) : 100% Guess ] 
        ( 1 HashFilter 
          ( IndexScan Customers CustomersKey )
        )
        ( IndexScan SalesOrders FK_CustomerID_ID[ hash( SalesOrders.CustomerID )
          in hashmap( Customers.ID ) : 100% Guess ] )
      )
    )
  )
)

For more information about the abbreviations used in a plan, see Abbreviations in the plan.