exchange partition(轉)
線上重定義表可以將一個非分割槽錶轉換成一個分割槽表。使用exchange 和split partition 也可以將一個非分割槽錶轉換為分割槽表。後者相比較前者,因為不受要轉換的資料量影響,因此也更方便、快捷一些。
exchange partition 操作能將一個分割槽表的一個分割槽和另一張表的資料互換,這裡的互換是segment 頭部資訊的修改,資料block 並不做改動,因此,和資料量無關,速度會非常快;完成後,再可以按照需要將分割槽具體split 成多個分割槽。
[@more@]步驟:
1.建立一個空的,只有一個分割槽的同構分割槽表
2.exchange partition with table 來互換資料
3.split 分割槽表的分割槽為合適的個數
-- 建立非分割槽表
create table test_objects as select * from user_objects;
-- 建立空的分割槽表
create table test_part_objects
partition by range(object_id)
(partition max_data values less than (maxvalue))
as select * from test_objects where 1=2;
select count(*) from test_objects;
1579
select count(*) from test_part_objects;
0
-- 執行exchange partition操作
alter table test_part_objects exchange partition max_data with table test_objects;
--分割槽表中有資料了,原表沒有了資料
select count(*) from test_objects;
0
select count(*) from test_part_objects;
1579
select count(*) from test_part_objects partition(max_data);
1579
--split分拆分割槽
alter table test_part_objects split partition max_data
at (54000) into (partition part_54000,partition max_data);
select count(*) from test_part_objects partition(max_data);
172
-- 再次執行exchange partition,將max_data分割槽中的資料交換到test_objects表
alter table test_part_objects exchange partition max_data with table test_objects;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1059160/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 分割槽函式partition by的基本用法【轉載】函式
- Partition Pruning和Partition-Wise Joins
- Clique Partition
- oracle partition by group by,詳解partition by和group by對比Oracle
- 分割槽Partition
- Exchange Online Mailbox RestorationAIREST
- 7.74 DATAOBJ_TO_PARTITIONOBJ
- 86. Partition List
- oracle partition by 語法Oracle
- B. Range and Partition
- Exchange - Add Owner of Distribution Group
- Peace or partition? Cyprus - Espresso EconomistEspresso
- 7.73 DATAOBJ_TO_MAT_PARTITIONOBJ
- 3-Partition 問題
- 【RabbitMQ】direct type exchange example in golangMQGolang
- 【RabbitMQ】topic type exchange example in golangMQGolang
- 【RabbitMQ】fanout type exchange example in golangMQGolang
- Data exchange of settype COMM_PRFREEATTR
- Exchange 2013 管理 視訊教程
- Codeforces 1948E Clique Partition
- 分割槽partition知識點
- Partition|Disk Utility 如何分割磁碟
- ROWNUMBER() OVER( PARTITION BY COL1
- Exchange2016日誌路徑
- Spark學習——分割槽Partition數Spark
- [LeetCode] 416. Partition Equal Subset SumLeetCode
- RabbitMQ 訊息佇列之 Exchange TypesMQ佇列
- oracle分割槽交換(exchange)技術Oracle
- Your Tokens Are Mine: A Suspicious Scam Token in A Top Exchange
- RabbitMQ學習心得體會之ExchangeMQ
- Laravel-exchange EWS郵件服務Laravel
- Oracle Partition 分割槽詳細總結Oracle
- PostgreSQL DBA(94) - PG 12 Improving Partition(Select)SQL
- PostgreSQL DBA(93) - PG 12 Improving Partition(Insert)SQL
- 分割槽函式Partition By的基本用法函式
- Kafka分割槽分配策略(Partition Assignment Strategy)Kafka
- [ARC190B] L Partition 題解
- Implementing Ethereum trading front-runs on the Bancor exchange in PythonPython
- oracle分割槽表和分割槽表exchangeOracle