Oracle Create Table as Select
CTAS employs the direct path load, in other words, it skips loading data into buffer cache.
PGA consumption
Consider two scenarios:
a) Create table target as select * from source;
The result of select statement is not saved in memory, Oracle writes it directly to disk. Even if source table is large, PGA and Temp is not used.
b) Create table target as select col1, sum(col2) from source group by col1;
Oracle has to do Hash Group By for this kind of query; PGA and temp possibly are used.
To create a new partitioned table, user needs to issue:
Create table xxx
Partition by range (colx)
(
Partition pxxx values less than ()
)
As Select * from xxx
To create the table in parallel, you can either:
1). Create table xxx parallel y as select * from zzz;
2). Create table yyy as select /*+ parallel */ * from zzz;
There's a major difference between statement 1 and 2. For statement 1, Oracle parallelizes both create and select parts, while for 2, only the select part is parallelized. When creating table in parallel, each parallel execution server allocates a new extent, and fills it with data.
Oracle documents state:
The CREATE operation of CREATE TABLE ... AS SELECT can be parallelized only by a PARALLEL clause or an ALTER SESSION FORCE PARALLEL DDL statement.
When the CREATE operation of CREATE TABLE ... AS SELECT is parallelized, Oracle Database also parallelizes the scan operation if possible.
The scan operation cannot be parallelized if, for example:
-
The SELECT clause has a NO_PARALLEL hint.
-
The operation scans an index of a nonpartitioned table.
When the CREATE operation is not parallelized, the SELECT can be parallelized if it has a PARALLEL hint or if the selected table (or partitioned index) has a parallel declaration.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/638844/viewspace-1061114/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sqlserver不能直接create table as select ......SQLServer
- CREATE TABLE AS SELECT(CAST)(二)-ConceptAST
- Oracle table selectOracle
- CREATE TABLE AS SELECT(CAST)(一)-ORA-1652AST
- insert into select 與 create table as的用法和區別(轉)
- 【SQL】14 UNION 操作符、SELECT INTO 語句、INSERT INTO SELECT 語句、CREATE DATABASE 語句、CREATE TABLE 語句SQLDatabase
- VBA從Excel中生成Oracle create tableExcelOracle
- create table 使用select查詢語句建立表的方法分享
- use azure data studio to create external table for oracleOracle
- ERROR 1786 (HY000): Statement violates GTID consistency: CREATE TABLE ... SELECTError
- create table of mysql databaseMySqlDatabase
- oracle 19c 無法create table解決Oracle
- create a partition table using a exsit table
- create table as select where 1=0會把null和not null屬性也帶上Null
- oracle10.2.0.4_create table_constraint_indexOracleAIIndex
- [Oracle] Create table as 速度測試nologging+parallelOracleParallel
- ORACLE的Copy命令和create table,insert into的比較Oracle
- create table if not exists Waiting for table metadata lockAI
- oracle create table官方手冊如何快速檢視學習方法Oracle
- MySQL5.6 create table原理分析MySql
- create table進階學習(一)
- create table進階學習(三)
- create table進階學習(四)
- oracle 10046與select table查詢表系列(一)Oracle
- oracle中用Create Table建立表時,Storage中引數的含義!Oracle
- MySQL的create table as 與 like區別MySql
- create table進階學習系列(八)
- create table進階學習系列(五)
- create table進階學習系列(七)
- create table進階學習系列(九)
- ORACLE資料庫壞塊的處理 (通過re-create table方法)Oracle資料庫
- create table之storage選項initial和其它
- T-SQL的CREATE TABLE語法(下)SQL
- T-SQL的CREATE TABLE語法(上)SQL
- create directory in OracleOracle
- create table進階學習(二)_全域性臨時表_global temporary table
- How to Quickly Create a Copy of a Table using Transact-SQLUISQL
- dual表與create table語句的關係