and/or its affiliates TYP3 TYP1 TYP7 JAN 2022 FEB 2022 CREATE TABLE EVENTS.. PARTITION BY RANGE (time_id) SUPARTITION BY LIST (model) … … JAN 2022 FEB 2022 DEFAULT SELECT .. FROM events WHERE model = ‘TYP7’; パーティション・プルーニング機能への影響はなし • 存在しないパーティションはDEFAULTになる パーティション・ワイズ結合に影響する
affiliates CREATE TABLE hybrid_partition_orders ( prod_id NUMBER NOT NULL, cust_id NUMBER NOT NULL, time_id DATE NOT NULL, channel_id NUMBER NOT NULL, promo_id NUMBER NOT NULL, quantity_sold NUMBER(10,2) NOT NULL, amount_sold NUMBER(10,2) NOT NULL ) EXTERNAL PARTITION ATTRIBUTES ( TYPE ORACLE_LOADER DEFAULT DIRECTORY sales_data … ) PARTITION BY RANGE (time_id) ( PARTITION sales_2022 VALUES LESS THAN ('01-01-2023'), PARTITION sales_2021 VALUES LESS THAN ('01-01-2022') EXTERNAL LOCATION ('sales2021_data.txt'), PARTITION sales_2020 VALUES LESS THAN ('01-01-2021') EXTERNAL LOCATION ('sales2020_data.txt') • 外部表を含めたパーティション表の作成 • 古くなったパーティションをストレージに外だしするが、DBからも参 照できるようにする • 単⼀のレンジおよびリスト・パーティションのみ対応 (23cからイン ターバルと⾃動リストが追加) • 外部パーティションについてはREAD ONLYになる • 外部パーティションに対してSPLIT、MERGE、MOVEメンテナン ス操作はできない Q4_2018 Q3_2018 Q2_2018 Q1_2018 Q4_2017 Q3_2017 Q2_2017 Q1_2017 Q4_2016 ORDERS OBJECT STORAGE TABLE PARTITIONED BY QUARTER SQL HOT DATA COLD DATA UPDATES
affiliates SQL> create table intRef_p (pkcol number not null, col2 varchar2(200), 2 constraint pk_intref primary key (pkcol)) 3 partition by range (pkcol) interval (10) 4 (partition p1 value less than (10)); Table created. SQL> create table infRef_c1 (pkcol number npt null, col2 varchar2(200), fkcol number not null, 2 constraint pk_c1 primary key (pkcol), 3 constraint fk_c1 foreign key (fkcol) references intRef_p(pkcol) ON DELETE CASCADE) 4 partition by range reference (fk_c1); Table created. SQL> select * from infRef_p; PKCOL COL2 --------- -------------------------- 333 data for truncate - p 999 data for truncate – p SQL> select * from infRef_p; PKCOL COL2 FKCOL --------- -------------------------- --------- 333 data for truncate – p 333 999 data for truncate – p 999 SQL> alter table infRef_p truncate partition for (999) cascade update indexes; SQL> select * from infRef_p; PKCOL COL2 --------- -------------------------- 333 data for truncate - p SQL> select * from infRef_p; PKCOL COL2 FKCOL --------- -------------------------- --------- 333 data for truncate – p 333
Oracle and/or its affiliates Parent Child 1 Child 2 Grand child 1 Grand child 2 Grand child 3 Great Grandchild 1 Parent Child Grand child 1 2 3 4 5 6 Parent Child 1 Child 2 Grand child 1 Grand child 2 Grand child 3 Great Grandchild 1 Parent Child Grand child 1
affiliates CREATE TABLE tx_simple ( TRAN_KEY NUMBER, INQUIRY_TIMESTAMP TIMESTAMP(6), RUN_DATE DATE) PARTITION BY RANGE (RUN_DATE) ( PARTITION TRAN_202107 VALUES LESS THAN (TO_DATE('20210801','yyyymmdd')), PARTITION TRAN_202108 VALUES LESS THAN (TO_DATE('20210901','yyyymmdd')), PARTITION TRAN_202109 VALUES LESS THAN (TO_DATE('20211001','yyyymmdd')), PARTITION TRAN_202110 VALUES LESS THAN (TO_DATE('20211101','yyyymmdd')), PARTITION TRAN_MAX VALUES LESS THAN (MAXVALUE) ) ; Table created. INSERT into tx_simple ( select object_id, LAST_DDL_TIME, add_months(TO_DATE('20210501','yyyymmdd'), mod(OBJECT_ID,12)) from DAB_OBJECTS where object_id is not null) ; 73657 rows created. CREATE UNIQUE INDEX tx_simple_PK ON tx_simple (TRAN_KEY) nologging GLOBALE PARTITION BY RANGE (TRAN_KEY) ( PARTITION P_Max VALUES LESS THAN (MAXVALUE) ) ; Index created. ALTER TABLE tx_simple ADD (CONSTRAINT tx_simple_PK PRIMARY KEY (TRAN_KEY) USING INDEX nologging) ; Table altered. create table DAILY_ETL_table as select * from tx_simple partition (TRAN_202107) ; Table created. alter table daily_ETL_table add (CONSTRAINT pk_etl primary key (TRAN_KEY) DISABLE VALIDATE) ; Table altered. alter table tx_simple exchange partition TRAN_202107 with table dailt_ETL_table including indexes WITHOUT VALIDATION UPDATE GLOBALE INDEXES ; Table altered.
Oracle and/or its affiliates JAN FEB MAR APR パーティション・キー: ORDER_DATE ゾーンマップ: SHIP_DATE JAN FEB MAR MARパーティションと APRパーティションは プルーニングされる JAN FEB MAR WHERE ship_date = TO_DATE(’10-JAN-2011’)