Oracle Consulting Oracle Training Oracle Support Development
Oracle Books
SQL Server Books
IT Books
Job Interview Books
Rampant Horse Books
911 Series
Pedagogue Books

Oracle Software
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle


Privacy Policy




Oracle Tips by Burleson 

Using CTAS with an Index Hint

The CTAS with an index hint executes quite differently than CTAS with order by. When using an index hint, the CTAS begins by retrieving the table rows from the original table using the existing index. Since the rows are initially retrieved in the proper order, there is no need to sort the result set, and the data is used immediately to create the new table.

The syntax for CTAS with an index hint appears below:
create table new_customer
tablespace customer_flip
storage (initial 500m
next 50m
maxextents unlimited)
as select /*+ index(customer customer_primary_key_idx) */ *
from customer;

When this statement executes, the database traverses the existing primary-key index to access the rows for the new table, bypassing the sorting operation. Most Oracle DBAs choose this method over the order by approach because the runtime performance of traversing an index is generally faster than using the PARALLEL clause and then sorting the entire result set.

The above is an excerpt from the "Oracle9i UNIX Administration Handbook" by Oracle press, authored by Donald K. Burleson.


Download your Oracle scripts now:

The definitive Oracle Script collection for every Oracle professional DBA



Linux Oracle commands syntax poster

ION Oracle tuning software

Oracle data dictionary reference poster

Oracle Forum

BC Oracle consulting support training

BC remote Oracle DBA   



 Copyright © 1996 -2017 by Burleson. All rights reserved.

Oracle® is the registered trademark of Oracle Corporation. SQL Server® is the registered trademark of Microsoft Corporation. 
Many of the designations used by computer vendors to distinguish their products are claimed as Trademarks

Hit Counter