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

Oracle Software
image
Write for Rampant
Publish with Rampant
Rampant News
Rampant Authors
Rampant Staff
 Phone
 800-766-1884
Oracle News
Oracle Forum
Oracle Tips
Articles by our Authors
Press Releases
SQL Server Books
image
image

Oracle 11g Books

Oracle tuning

Oracle training

Oracle support

Remote Oracle

STATSPACK Viewer

Privacy Policy

 

 
 

ss

Oracle Tips by Burleson 

Using CTAS with the order by Clause

When using CTAS with the order by clause, you are directing Oracle to perform the following operations.

As we can see, the full table scan can be used with Parallel Query to speed the execution, but we still have a large disk sort following the collection of the rows. Because of the size of most tables, this sort will be done in the TEMP tablespace.

Here is an example of the SQL syntax to perform a CTAS with order by:

create table new_customer
tablespace customer_flip
storage (initial 500m
next 50m
maxextents unlimited)
parallel (degree 11)
as select * from customer
order by customer_number;

Using CTAS with order by can be very slow without the parallel clause. A parallel full table scan reads the original table quickly (in non-index order).

As we know from Oracle Parallel Query, the CTAS operation will cause Oracle to spawn to multiple background processes to service the full table scan. This often makes the order by approach faster than using the index-hint approach to CTAS. The choice to use parallel depends on the database server. If your hardware has multiple CPUs and many (perhaps hundreds of) processes, using parallel is likely to be significantly faster. However, if your hardware configuration has a relatively modest number of processes (such as the four specified in the example), the index-hint approach is likely to be faster.


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

 

Download your Oracle scripts now:

www.oracle-script.com

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