Execution Plan image:
Table Access operation.
TABLE ACCESS HASH is analogous to TABLE ACCESS BY ROWID; instead of accessing rows by ROWID, the optimizer calculates the location of the row inside the table using a hash formula on the key columns of the table and then uses that value to access the rows.
Assume that the COMPANY table is stored in a hash cluster. Execute the following SQL statement:
select Name
from COMPANY
where Company_ID = 12345
and Active_Flag = 'Y';
TABLE ACCESS HASH COMPANY
Since the Company_ID is the primary key for the COMPANY table, the hash formula uses the Company_ID value to determine the ROWID of the sought row. Since the ROWID is determined by the hash formula, there is no need for an index access to retrieve the specified row.
Note: See the Top SQL Tuning Tips topic for tuning guidance related to the use of hash clusters for very large tables.
Execution Plan image:
Table Access operation.
A sample table scan retrieves a random sample of data from a table. This access method is used when the statement's FROM clause includes the SAMPLE clause or the SAMPLE BLOCK clause. To perform a sample table scan when sampling by rows (the SAMPLE clause), Oracle reads a specified percentage of rows in the table and examines each of these rows to determine whether it satisfies the statement's WHERE clause. To perform a sample table scan when sampling by blocks (the SAMPLE BLOCK clause), Oracle reads a specified percentage of the table's blocks and examines each row in the sampled blocks to determine whether it satisfies the statement's WHERE clause.
Oracle does not support sample table scans when the query involves a join or a remote table. However, you can perform an equivalent operation by using a CREATE TABLE AS SELECT query to materialize a sample of an underlying table and then rewrite the original query to refer to the newly created table sample. Additional queries can be written to materialize samples for other tables. Sample table scans require the cost-based optimizer.
The following statement uses a sample table scan to access 1% of the emp table, sampling by blocks:
SELECT *
FROM emp SAMPLE BLOCK (1);
Operation |
Options |
Object_name |
SELECT STATEMENT |
SAMPLE |
EMP |
The TABLE QUEUE operation indicates use of parallel execution plan.
Execution Plan image:
Miscellaneous operation.
The TEMP TABLE GENERATION operation creates a temporary dimension table for dimension tables that have been joined by a Star Transformation. For each dimension table in the joined set, TEMP TABLE GENERATION creates a temporary table to replace the table in the Execution Plan. A temporary table is created using two steps: create table and insert each. Since there are at least two tables in a join, this operation creates a minimum of four temporary tables.
© ALL RIGHTS RESERVED. Nutzungsbedingungen Datenschutz Cookie Preference Center