forked from docs/doc-exports
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com> Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Lu, Huayi <luhuayi@huawei.com> Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
424 lines
33 KiB
HTML
424 lines
33 KiB
HTML
<a name="EN-US_TOPIC_0000001819416149"></a><a name="EN-US_TOPIC_0000001819416149"></a>
|
|
|
|
<h1 class="topictitle1">PARTITION</h1>
|
|
<div id="body8662426"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p1954502912513">The tool does not support migration of partitions/subpartitions and the partition/subpartition keywords are commented in the migrated scripts:</p>
|
|
<ul id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_ul7317348256"><li id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_li15292342258">Range partition/subpartition</li><li id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_li529153422517">List partition/subpartition</li><li id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_li53173411256">Hash partition/subpartition</li></ul>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p95429304579">Scenario 1: Assume that the configuration parameters (<a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li33711169269">•tdMigrateCASE_N</a> and <a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li143711916152611">•tdMigrateRANGE_N</a>) are set to <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b212899169832148">comment</strong> or <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b129390275832148">range</strong> respectively.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p73219161102">The following is a Teradata CREATE TABLE script with nested partitions.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p142791750151216"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b156863236332148">Input - PARTITION BY RANGE</strong><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b8345744432148">_N</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen72807502123">CREATE TABLE tab1
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
PRIMARY INDEX (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY ( CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
, RANGE_N( entry_dt BETWEEN DATE '2012-01-01' AND DATE '2025-12-31' EACH INTERVAL '1' DAY, NO RANGE )
|
|
);</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p195162511618"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b26391957102315">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen1821731344">CREATE TABLE tab1
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
DISTRIBUTE BY HASH (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY RANGE (entry_dt) ( PARTITION tab1_p1 START (CAST('2012-01-01' AS DATE))
|
|
END (CAST('2025-12-31' AS DATE))
|
|
EVERY (INTERVAL '1' DAY) );</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p4243162564219"><u id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_u168650783832148">Scenario 2:</u> Assume that the configuration parameters (<a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li33711169269">tdMigrateCASE_N</a> and <a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li143711916152611">tdMigrateRANGE_N</a>) are set to <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b162059745432148">comment</strong> or <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b87685325032148">range</strong> respectively.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p986415418218">The following is a Teradata CREATE TABLE script with nested partitions.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p192098317010"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b9635358212">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen19818526901">CREATE TABLE tab2
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
PRIMARY INDEX (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY ( RANGE_N( entry_dt BETWEEN DATE '2012-01-01' AND DATE '2025-12-31' EACH INTERVAL '1' DAY, NO RANGE )
|
|
, CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
);</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p1348317121909"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b189881448524">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen118833118018">CREATE TABLE tab2
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
DISTRIBUTE BY HASH (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY RANGE (entry_dt) ( PARTITION tab2_p1 START (CAST('2012-01-01' AS DATE))
|
|
END (CAST('2025-12-31' AS DATE))
|
|
EVERY (INTERVAL '1' DAY) );</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p1731731204310"><u id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_u161361919932148">Scenario 3:</u> Assume that the configuration parameters (<a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li33711169269">tdMigrateCASE_N</a> and <a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li143711916152611">tdMigrateRANGE_N</a>) are set to values other than <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b77938664532148">comment</strong> or <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b54791757132148">range</strong> respectively.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p185318301315">Partition syntax will not be commented and the remaining syntax will be migrated.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p4242152211018"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b1365043518214">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen10737192715215">CREATE TABLE tab1
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
PRIMARY INDEX (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY ( CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
, RANGE_N( entry_dt BETWEEN DATE '2012-01-01' AND DATE '2025-12-31' EACH INTERVAL '1' DAY, NO RANGE )
|
|
);</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p55617109215"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b361718491423">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen134692321026">CREATE TABLE tab2
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
DISTRIBUTE BY HASH (entry_id, oper_id, source_system_cd)
|
|
/* PARTITION BY ( CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
, RANGE_N( entry_dt BETWEEN DATE '2012-01-01' AND DATE '2025-12-31' EACH INTERVAL '1' DAY, NO RANGE )
|
|
) */
|
|
;</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p185836119444"><u id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_u90662564332148">Scenario 4:</u> Assume that the configuration parameters (<a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li33711169269">tdMigrateCASE_N</a> and <a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li143711916152611">tdMigrateRANGE_N</a>) are set to any value.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p2712163813413">The following is another TD create table script with RANGE_N partition (without nested partitions).</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p1776920226015"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b113525361227">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen1520511404416">CREATE TABLE tab4
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
PRIMARY INDEX (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY (RANGE_N( entry_dt BETWEEN DATE '2012-01-01' AND DATE '2025-12-31' EACH INTERVAL '1' DAY, NO RANGE )
|
|
);</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p173406242045"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b91658451329">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen19529194818411">CREATE TABLE tab4
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
DISTRIBUTE BY HASH (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY RANGE (entry_dt) ( PARTITION tab4_p1 START (CAST('2012-01-01' AS DATE))
|
|
END (CAST('2025-12-31' AS DATE))
|
|
EVERY (INTERVAL '1' DAY) );</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p11251105814448"><u id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_u36809186632148">Scenario 5:</u> Assume that the configuration parameters (<a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li33711169269">tdMigrateCASE_N</a> and <a href="dws_16_0014.html#EN-US_TOPIC_0000001819416085__en-us_topic_0000001706224349_en-us_topic_0000001432527901_li143711916152611">tdMigrateRANGE_N</a>) are set to <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b96894997732148">comment</strong> or <strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b69989664932148">range</strong> respectively.</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p4561204563">The following is another teradata create table script with CASE_N partition (without nested partitions).</p>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p5842164215416"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b5431135121512">Input</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen156660101614">CREATE TABLE tab5
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
PRIMARY INDEX (entry_id, oper_id, source_system_cd)
|
|
PARTITION BY ( CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
);</pre>
|
|
<p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p19422563518"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b113271466215">Output</strong></p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen293631316615">CREATE TABLE tab5
|
|
( entry_id integer not null
|
|
, oper_id integer not null
|
|
, source_system_cd varchar(5)
|
|
, entry_dt date
|
|
, file_id integer
|
|
, load_id integer
|
|
, contract_id varchar(50)
|
|
, contract_type_cd varchar(50)
|
|
)
|
|
DISTRIBUTE BY HASH (entry_id, oper_id, source_system_cd)
|
|
/* PARTITION BY ( CASE_N( source_system_cd = '00000'
|
|
, source_system_cd = '00002'
|
|
, source_system_cd = '00006'
|
|
, source_system_cd = '00018'
|
|
, NO CASE )
|
|
) */
|
|
;</pre>
|
|
<div class="section" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_section09991730763"><h4 class="sectiontitle">Partition of RANGE_N in the String Columns</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_table169681644713" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row7969862471"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.33.2.1.3.1.1"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p796918618475"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b09692069473">Input</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.33.2.1.3.1.2"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p6969867471"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b17969564479">Output</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row3969368470"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.33.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen496916664717">CREATE SET TABLE SC.TAB , NO FALLBACK,
|
|
NO BEFORE JOURNAL,
|
|
NO AFTER JOURNAL,
|
|
CHECKSUM=DEFAULT,
|
|
DEFAULT MERGEBLOCKRATIO
|
|
(
|
|
ACCOUNT_NUM VARCHAR(255) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
|
|
,ACCOUNT_MODIFIER_NUM CHAR(18) CHARACTER SET LATIN NOT CASESPECIFIC NOT NULL
|
|
,DATA_SOURCE_ID CHAR(10) CHARACTER SET LATIN NOT CASESPECIFIC
|
|
,END_DT DATE FORMAT 'YYYY-MM-DD'
|
|
,UPD_TXF_BATCHTD INTEGER COMPRESS
|
|
)
|
|
PRIMARY INDEX XPKT0300_AGREEMENT (ACCOUNT_NUM,ACCOUNT_MODIFIER_NUM)
|
|
PARTITION BY ( RANGE_N(DATA_SOURCE_ID BETWEEN 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' AND 'ZZ', NO RANGE ,UNKNOWN) ,CASE_N(END_DT IS NULL , NO CASE , UNKNOWN))
|
|
;</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.33.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen1497014618476">CREATE
|
|
TABLE
|
|
SC.TAB (
|
|
ACCOUNT_NUM VARCHAR( 255 ) /* CHARACTER SET LATIN*/ /* NOT CASESPECIFIC*/ NOT NULL
|
|
,ACCOUNT_MODIFIER_NUM CHAR( 18 ) /* CHARACTER SET LATIN*/ /* NOT CASESPECIFIC*/ NOT NULL
|
|
,DATA_SOURCE_ID CHAR( 10 ) /* CHARACTER SET LATIN*/ /* NOT CASESPECIFIC*/
|
|
,END_DT DATE
|
|
,UPD_TXF_BATCHTD INTEGER /* COMPRESS */
|
|
) DISTRIBUTE BY HASH (
|
|
ACCOUNT_NUM
|
|
,ACCOUNT_MODIFIER_NUM
|
|
)/* PARTITION BY (
|
|
RANGE_N (
|
|
DATA_SOURCE_ID BETWEEN 'A'
|
|
,'B'
|
|
,'C'
|
|
,'D'
|
|
,'E'
|
|
,'F'
|
|
,'G'
|
|
,'H'
|
|
,'I'
|
|
,'J'
|
|
,'K'
|
|
,'L'
|
|
,'M'
|
|
,'N'
|
|
,'O'
|
|
,'P'
|
|
,'Q'
|
|
,'R'
|
|
,'S'
|
|
,'T'
|
|
,'U'
|
|
,'V'
|
|
,'W'
|
|
,'X'
|
|
,'Y'
|
|
,'Z' AND 'ZZ'
|
|
,NO RANGE
|
|
,UNKNOWN
|
|
)
|
|
,*/
|
|
/* CASE_N(END_DT IS NULL , NO CASE , UNKNOWN)) */
|
|
;</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_section131675517117"><h4 class="sectiontitle">RANGE_N with different partition INTERVAL</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_table14786162684711" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row18786526114714"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.34.2.1.3.1.1"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p678617261474"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b1878772654712">Input</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.34.2.1.3.1.2"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p127873264470"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b10787826154720">Output</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row11787192694716"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.34.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen478710269477">CREATE MULTISET TABLE tab1
|
|
( TICD VARCHAR(10)
|
|
, TCIT VARCHAR(10)
|
|
, TCCM VARCHAR(50)
|
|
, DW_Stat_Dt DATE
|
|
)
|
|
PRIMARY INDEX ( TICD )
|
|
PARTITION BY RANGE_N
|
|
( DW_Stat_Dt BETWEEN DATE '0001-01-01' AND DATE '0001-01-04' EACH INTERVAL '1' DAY,
|
|
DATE '0001-01-05' AND DATE '1899-12-31',
|
|
DATE '1900-01-01' AND DATE '1900-01-01',
|
|
DATE '1900-01-02' AND DATE '1999-12-31',
|
|
DATE '2000-01-01' AND DATE '2009-12-31' EACH INTERVAL '1' YEAR,
|
|
DATE '2010-01-01' AND DATE '2021-12-31' EACH INTERVAL '1' DAY,
|
|
DATE '9999-12-31' AND DATE '9999-12-31',
|
|
NO RANGE );</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.34.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen127881026194711">CREATE TABLE tab1
|
|
( TICD VARCHAR( 10 )
|
|
, TCIT VARCHAR( 10 )
|
|
, TCCM VARCHAR( 50 )
|
|
, DW_Stat_Dt DATE
|
|
)
|
|
DISTRIBUTE BY HASH (TICD)
|
|
PARTITION BY RANGE (DW_Stat_Dt)
|
|
( PARTITION tab1_0 START (DATE '0001-01-01') END (DATE '0001-01-04') EVERY (INTERVAL '1' DAY),
|
|
PARTITION tab1_1 START (DATE '0001-01-04') END (DATE '1899-12-31'),
|
|
PARTITION tab1_2 START (DATE '1899-12-31') END (DATE '1900-01-01'),
|
|
PARTITION tab1_ 3 START (DATE '1900-01-01') END (DATE '1999-12-31'),
|
|
PARTITION tab1_4 START (DATE '1999-12-31') END (DATE '2009-12-31') EVERY (INTERVAL '1' YEAR) ,
|
|
PARTITION tab1_5 START (DATE '2009-12-31') END (DATE '2021-12-31') EVERY (INTERVAL '1' DAY) ,
|
|
PARTITION tab1_6 START (DATE '2021-12-31') END (DATE '9999-12-31')
|
|
);</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_section43361852101520"><h4 class="sectiontitle">RANGE_N with * for start-date</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_table17782174318474" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row1978344324716"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.35.2.1.3.1.1"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p1278344310475"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b17783643194717">Input</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.35.2.1.3.1.2"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p177831543174719"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b12783114314711">Output</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row378394316472"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.35.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen2783114310478">CREATE MULTISET TABLE Orders5 (
|
|
StoreNo SMALLINT,
|
|
OrderNo INTEGER,
|
|
OrderDate DATE,
|
|
OrderTotal INTEGER
|
|
)
|
|
PRIMARY INDEX(OrderNo)
|
|
PARTITION BY RANGE_N (
|
|
OrderDate BETWEEN DATE * AND DATE '2016-12-31' EACH INTERVAL '1' YEAR,
|
|
DATE '2017-01-01' EACH INTERVAL '1' MONTH,
|
|
DATE '2020-01-01' AND DATE '2020-12-31' EACH INTERVAL '1' DAY
|
|
);</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.35.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen5784843114719">CREATE TABLE Orders5 (
|
|
StoreNo SMALLINT,
|
|
OrderNo INTEGER,
|
|
OrderDate DATE,
|
|
OrderTotal INTEGER
|
|
)
|
|
DISTRIBUTE BY HASH (OrderNo)
|
|
PARTITION BY RANGE (OrderDate)
|
|
( PARTITION Orders5_0 START (DATE '0001-01-01') END (DATE '2016-12-31') EVERY (INTERVAL '1' YEAR),
|
|
PARTITION Orders5_1 START (DATE '2016-12-31') END (DATE '2020-01-01') EVERY (INTERVAL '1' MONTH),
|
|
PARTITION Orders5_2 START (DATE '2020-01-01') END (DATE '2020-12-31') EVERY (INTERVAL '1' DAY)
|
|
);</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_section12875192071818"><h4 class="sectiontitle">RANGE_N with * for end-date</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_table047512148186" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row20475151410181"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.36.2.1.3.1.1"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p45542019529"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b185559075214">Input</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.36.2.1.3.1.2"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p15559065212"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b12555190145211">Output</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row9475141401815"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.36.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen047531461815">CREATE SET TABLE Orders4 (
|
|
StoreNo SMALLINT,
|
|
OrderNo INTEGER,
|
|
OrderDate DATE,
|
|
OrderTotal INTEGER
|
|
)
|
|
PRIMARY INDEX(OrderNo)
|
|
PARTITION BY RANGE_N (
|
|
OrderDate BETWEEN DATE '2010-01-01' AND '2016-12-31' EACH INTERVAL '1' YEAR,
|
|
DATE '2017-01-01' EACH INTERVAL '1' MONTH,
|
|
DATE '2019-01-01' AND *
|
|
);</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.36.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen13476151481811">CREATE TABLE Orders4 (
|
|
StoreNo SMALLINT,
|
|
OrderNo INTEGER,
|
|
OrderDate DATE,
|
|
OrderTotal INTEGER
|
|
)
|
|
DISTRIBUTE BY HASH (OrderNo)
|
|
PARTITION BY RANGE (OrderDate)
|
|
( PARTITION Orders4_0 START (DATE '2010-01-01') END (DATE '2016-12-31') EVERY (INTERVAL '1' YEAR),
|
|
PARTITION Orders4_1 START (DATE '2016-12-31') END (DATE '2020-01-01') EVERY (INTERVAL '1' MONTH) ,
|
|
PARTITION Orders4_2 START (DATE '2020-01-01') END (MAXVALUE)
|
|
);</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_section8812316161919"><h4 class="sectiontitle">RANGE_N with comma seperated values</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_table7667142611199" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row76677269192"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.37.2.1.3.1.1"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p138621745213"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b28621795211">Input</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.37.2.1.3.1.2"><p id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_p68620719521"><strong id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_b188625775216">Output</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_row166681226181911"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.37.2.1.3.1.1 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen96684260191">CREATE TABLE orders10
|
|
(storeid INTEGER NOT NULL
|
|
,productid INTEGER NOT NULL
|
|
,orderdate DATE NOT NULL
|
|
,totalorders INTEGER NOT NULL)
|
|
PRIMARY INDEX (storeid, productid)
|
|
PARTITION BY ( RANGE_N(totalorders BETWEEN *, 100, 1000 AND *) );</pre>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.37.2.1.3.1.2 "><pre class="screen" id="EN-US_TOPIC_0000001819416149__en-us_topic_0000001657865182_en-us_topic_0000001434630657_screen186691626101914">CREATE TABLE orders10
|
|
(storeid INTEGER NOT NULL
|
|
,productid INTEGER NOT NULL
|
|
,orderdate DATE NOT NULL
|
|
,totalorders INTEGER NOT NULL)
|
|
DISTRIBUTE BY HASH (storeid, productid)
|
|
PARTITION BY RANGE (totalorders)
|
|
( PARTITION Orders10_0 END (100),
|
|
PARTITION Orders10_1 END (1000),
|
|
PARTITION Orders10_2 END (MAXVALUE)
|
|
);</pre>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_16_0061.html">Migrating Tables</a></div>
|
|
</div>
|
|
</div>
|
|
|