|Oracle® SQL Developer Oracle TimesTen In-Memory Database Support User's Guide
Part Number E25286-01
|PDF · Mobi · ePub|
The query optimizer uses statistics stored in TimesTen database system tables to determine the optimal execution plan for a statement. Table-level statistics such as the number of rows in a table are stored in the
SYS.TBL_STATS table. Column-level statistics such as the minimum and maximum value, and the number of unique values in a column are stored in the
Table and column statistics are not computed as updates occur on regular and cache tables. Instead statistics are updated when an explicit request is made.
You can update statistics for all tables owned by an user or for a specific table owned by an user.
To update statistics for all tables, right-click the Tables node and choose Statistics > Update.
To update statistics for a specific table, click the + to the left of the Tables node. Right-click the name of the table and choose Statistics > Update.
If you are unable to find the table, see "Viewing the characteristics of a table".
In the Prompts tab of the Update statistics dialog, choose Invalidate referenced commands to invalidate the execution plans of statements that reference the table on which statistics are updated. Invalidating a statement's execution plan causes that statement to be recompiled or reprepared upon its next execution.
For Interval type for table statistics, choose Complete interval to divide the rows of the table into two or more intervals and compute statistics on each interval, or Single interval to compute statistics on the entire set of rows as a single interval. You must define a range index on the table to compute complete interval statistics.
To view the optimizer statistics of a table, click the name of the table.
If you are unable to find the table that you are looking for, see "Locating a TimesTen database object".
The number of rows in the table
A timestamp indicating when statistics were most recently updated for the table
The bottom section shows the column statistics. For each column, the following is displayed:
The name of the column
The number of intervals the data was divided into to compute statistics
Total number of
Total number of non-
NULL unique values
Total number of rows in each interval
For each interval of each column, the following is displayed:
The number of unique values other than the most frequently occurring value
The number of rows that contain a value other than the most frequently occurring value
The number of rows that contain the most frequently occurring value
The minimum value
The maximum value
The most frequently occurring value
For more information about query optimizer statistics, see "Statistics" in the Oracle In-Memory Database Cache Introduction, "When optimization occurs" in the Oracle TimesTen In-Memory Database Operations Guide or "ttOptUpdateStats" in the Oracle TimesTen In-Memory Database Reference.
A statement must be prepared or compiled before it is executed. When the statement is prepared or compiled, the query optimizer generates an execution plan for the statement.
To view the execution plan of a statement, create the statement in the SQL Worksheet. If you do not have a worksheet open in your connection, right-click the node of the connection name and select Open SQL Worksheet. See Figure 1-3, "Viewing a TimesTen connection".
If you do not have a connection open, select SQL Worksheet to establish a connection and then open a worksheet for that connection.
The Select Connection dialog appears. In the Connection field, select the name of the connection. Click OK.
A connection to the TimesTen database is established if a connection associated with the selected connection name does not exist.
Before composing the statement in SQL Worksheet, make sure appropriate indexes have been created on the tables that are being referenced in the statement, and that table and column statistics have been updated. For more information about updating statistics, see "Updating the table and column statistics used by the query optimizer".
Compose the statement in the SQL Worksheet. Then choose Explain Plan to display the execution plan for the statement.
The execution plan is shown in the Explain Plan pane and is displayed in a hierarchical format in reverse chronological order such that the operation at the bottom of the tree is processed first and the operation at the top of the tree is processed last. For each operation, the plan shows the table or index the operation is performed on, or if applicable, the expressions of the statement's predicate the operation is processing. Types of operations that can appear in the execution plan include table or index scan (with lock granularity shown), join, group and sort.
For more information about interpreting an execution plan, see "Optimizer plan" in the Oracle In-Memory Database Cache Introduction or "Viewing SQL query plans" in the Oracle TimesTen In-Memory Database Operations Guide.
For more information about query performance tuning, see "Viewing SQL query plans" in the Oracle TimesTen In-Memory Database Operations Guide.