DB2_多維叢集表索引延遲清理
目的:
測試DB2多維叢集表索引延遲清理,本指令碼摘錄自DB2安裝目錄admin_scripts/fasterrollout.db2。
版本:Windows DB2 Express-C V9.7
操作步驟:
使用"db2cmd db2 -t"進入互動模式,執行後續操作。
1,使用預設"IMMEDIATE INDEX CLEANUP":
CONNECT TO sample;
-- *************************************************************************
-- Following shows how to perform. delete that uses IMMEDIATE INDEX
-- CLEANUP roll out type.
-- *************************************************************************
-- Create MDC table 'MDC_temp'.
CREATE TABLE MDC_emp (emp_no INT NOT NULL, emp_sal DOUBLE,
emp_location CHAR (25))
ORGANIZE BY DIMENSIONS (emp_no, emp_location);
-- Populate table 'MDC_emp' with data.
INSERT INTO MDC_emp values (100, 1.25, 'BANGALORE');
INSERT INTO MDC_emp values (200, 2.00, 'BANGALORE');
INSERT INTO MDC_emp values (300, 2.00, 'CHENNAI');
INSERT INTO MDC_emp values (400, 3.00, 'CHENNAI');
INSERT INTO MDC_emp values (500, 2.00, 'PUNE');
INSERT INTO MDC_emp values (600, 2.00, 'BANGALORE');
-- Create index on columns 'emp_no' and 'emp_location'.
CREATE INDEX indx1 ON MDC_emp (emp_no, emp_location);
-- The below DELETE statement uses 'IMMEDIATE INDEX CLEANUP ROLLOUT' as default.
-- Indexes are cleaned up at delete time and rolled out blocks will be
-- available for immediate use.
DELETE FROM MDC_emp WHERE emp_sal = 2.00 AND emp_location = 'BANGALORE';
-- Drop the table.
DROP TABLE MDC_emp;
2,使用"DEFERRED INDEX CLEANUP":
-- *************************************************************************
-- Following shows how to perform. DELETE that uses DEFERRED INDEX CLEANUP
-- roll out type. This type of index cleanup is very efficient in case of
-- large tables. This even shows how to change the DEFAULT mode to
-- DEFERRED mode.
-- *************************************************************************
-- Create MDC table 'MDC_temp'.
CREATE TABLE MDC_emp (emp_no INT NOT NULL, emp_sal DOUBLE,
emp_location CHAR (25))
ORGANIZE BY DIMENSIONS (emp_no, emp_location);
-- Populate table 'MDC_emp' with data.
INSERT INTO MDC_emp values (100, 1.25, 'BANGALORE');
INSERT INTO MDC_emp values (200, 2.00, 'BANGALORE');
INSERT INTO MDC_emp values (300, 2.00, 'CHENNAI');
INSERT INTO MDC_emp values (400, 3.00, 'CHENNAI');
INSERT INTO MDC_emp values (500, 2.00, 'PUNE');
INSERT INTO MDC_emp values (600, 2.00, 'BANGALORE');
-- Create index on columns 'emp_no' and 'emp_location'.
CREATE INDEX indx1 ON MDC_emp (emp_no, emp_location);
-- Change the roll out type to 'DEFERRED'.
SET CURRENT MDC ROLLOUT MODE = DEFERRED;
-- The above statement changes the roll out type from 'IMMEDIATE' to 'DEFERRED'.
-- Once the delete statement is committed, DB2 begins to cleanup
-- RID indexes asynchronously. Users cannot use the rolled out blocks immediately
-- after DELETE. These blocks will be available for reuse only after index cleanup
-- is completed by DB2.
DELETE FROM MDC_emp WHERE emp_sal = 2.00 OR emp_location = 'BANGALORE';
-- Drop table.
DROP TABLE MDC_emp;
-- Disconnect form. database.
CONNECT RESET;
TERMINATE;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18922393/viewspace-702161/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE 11g RAC 叢集互連延遲Oracle
- 阿里雲註冊叢集+Prometheus 解決多雲容器叢集運維痛點阿里Prometheus運維
- 延遲塊清理介紹(select也會產生redo的原因)
- DB2_建立重組索引DB2索引
- RabbitMQ延遲訊息的延遲極限是多少?MQ
- java多執行緒之延遲初始化Java執行緒
- 延遲釋出
- 如何運維多叢集資料庫?58 同城 NebulaGraph Database 運維實踐運維資料庫Database
- PostgreSQL叢集方案相關索引頁SQL索引
- Mybatis09_一對一、一對多、多對多、延遲載入MyBatis
- 訊息佇列-一篇讀懂rabbitmq(生命週期,confirm模式,延遲佇列,叢集)佇列MQ模式
- OGG複製程式延遲高,優化方法一(使用索引)優化索引
- rac叢集日常維護命令
- MongoDB叢集運維筆記MongoDB運維筆記
- hbase叢集 常用維護命令
- RabbitMQ叢集運維實踐MQ運維
- redis哨兵,叢集和運維Redis運維
- Laravel 延遲佇列Laravel佇列
- WebGL之延遲著色Web
- Mybatis延遲查詢MyBatis
- 疫情延遲 題解
- redis 延遲佇列Redis佇列
- Elasticsearch系列---生產叢集的索引管理Elasticsearch索引
- 實現簡單延遲佇列和分散式延遲佇列佇列分散式
- 基於rabbitmq延遲外掛實現分散式延遲任務MQ分散式
- OGG複製程式延遲高,優化方法二(存在索引),SQL選擇不好的索引優化索引SQL
- 多層代理下解決鏈路低延遲的技巧
- js:原生多張圖片延遲載入(圖片自己找)JS
- mongos分片叢集管理和運維Go運維
- linux搭建kafka叢集,多master節點叢集說明LinuxKafkaAST
- 【MySQL】MySQL(四)儲存引擎、索引、鎖、叢集MySql儲存引擎索引
- 延遲阻塞佇列 DelayQueue佇列
- SQL之延遲約束SQL
- script的延遲執行
- zookeeper之watch事件延遲事件
- oracle的延遲約束Oracle
- hyperf redis延遲佇列Redis佇列
- 從庫延遲案例分析