doc-exports/docs/dws/dev/dws_04_1029.html
Lu, Huayi e6fa411af0 DWS DEV 830.201 version
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>
2024-05-16 07:24:04 +00:00

149 lines
32 KiB
HTML

<a name="EN-US_TOPIC_0000001809519832"></a><a name="EN-US_TOPIC_0000001809519832"></a>
<h1 class="topictitle1">CREATE TABLE</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_sf337ecb5bde84580afed94be7bbf5fb9"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p47418203818">Create an HStore table in the current database. The table will be owned by the user who created it.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p6721810388">In a hybrid data warehouse, you can use DDL statements to create HStore tables. To create an HStore table, set <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b1755134251519">enable_hstore</strong> to <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b289064417151">true</strong> and set <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b9316134714157">orientation</strong> to <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b410764811511">column</strong>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_s0c57396ef17642e9a39a88ab766472e1"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_u833942a091c642dba1f12f016ec573a6"><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li10869171163914">To create an HStore table, you must have the <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b7783144910229">USAGE</strong> permission on schema cstore.</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li168691211123910">The table-level parameters <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b198331944181717">enable_delta</strong> and <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b1815294615173">enable_hstore</strong> cannot be enabled at the same time. The parameter <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b67571335183">enable_delta</strong> is used to enable delta for common column-store tables and conflicts with <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b109122819187">enable_hstore</strong>.</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li88696115396">Each HStore table is bound to a delta table. The OID of the delta table is recorded in the <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b11921615122114">reldeltaidx</strong> field in <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b179831161214">pg_class</strong>. (The <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b166491624162116">reldelta</strong> field is used by the delta table of the column-store table).</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_s24f4eafc7fd349969c837eaaf863b260"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_s8ca28ce519cb41439fb1df4c043e6e8b"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span></pre></div></td><td class="code"><div><pre><span></span><span class="k">CREATE</span><span class="w"> </span><span class="k">TABLE</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="k">IF</span><span class="w"> </span><span class="k">NOT</span><span class="w"> </span><span class="k">EXISTS</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="k">table_name</span>
<span class="p">(</span><span class="err">{</span><span class="w"> </span><span class="k">column_name</span><span class="w"> </span><span class="n">data_type</span><span class="w"> </span>
<span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">LIKE</span><span class="w"> </span><span class="n">source_table</span><span class="w"> </span><span class="p">[</span><span class="n">like_option</span><span class="w"> </span><span class="p">[...]</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="err">}</span>
<span class="err">}</span>
<span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">])</span>
<span class="p">[</span><span class="w"> </span><span class="k">WITH</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="err">{</span><span class="n">storage_parameter</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">value</span><span class="err">}</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">]</span>
<span class="p">[</span><span class="w"> </span><span class="n">TABLESPACE</span><span class="w"> </span><span class="n">tablespace_name</span><span class="w"> </span><span class="p">]</span>
<span class="p">[</span><span class="w"> </span><span class="n">DISTRIBUTE</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="n">HASH</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="k">column_name</span><span class="w"> </span><span class="p">[,...])]</span>
<span class="p">[</span><span class="w"> </span><span class="k">TO</span><span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="k">GROUP</span><span class="w"> </span><span class="n">groupname</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">NODE</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">nodename</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">]</span>
<span class="p">[</span><span class="w"> </span><span class="n">PARTITION</span><span class="w"> </span><span class="k">BY</span><span class="w"> </span><span class="err">{</span><span class="w"> </span>
<span class="w"> </span><span class="err">{</span><span class="n">RANGE</span><span class="w"> </span><span class="p">(</span><span class="n">partition_key</span><span class="p">)</span><span class="w"> </span><span class="p">(</span><span class="w"> </span><span class="n">partition_less_than_item</span><span class="w"> </span><span class="p">[,</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">)</span><span class="err">}</span><span class="w"> </span>
<span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="p">[</span><span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="n">ENABLE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">DISABLE</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="k">ROW</span><span class="w"> </span><span class="n">MOVEMENT</span><span class="w"> </span><span class="p">]</span><span class="w"> </span><span class="p">];</span><span class="w"> </span>
<span class="n">The</span><span class="w"> </span><span class="k">options</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="k">LIKE</span><span class="w"> </span><span class="k">are</span><span class="w"> </span><span class="k">as</span><span class="w"> </span><span class="n">follows</span><span class="p">:</span>
<span class="err">{</span><span class="w"> </span><span class="k">INCLUDING</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">EXCLUDING</span><span class="w"> </span><span class="err">}</span><span class="w"> </span><span class="err">{</span><span class="w"> </span><span class="k">DEFAULTS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">CONSTRAINTS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">INDEXES</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">STORAGE</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">COMMENTS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">PARTITION</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">RELOPTIONS</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="n">DISTRIBUTION</span><span class="w"> </span><span class="o">|</span><span class="w"> </span><span class="k">ALL</span><span class="w"> </span><span class="err">}</span>
</pre></div></td></tr></table></div>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_section12566103412113"><h4 class="sectiontitle">Differences Between Delta Tables</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_table02451929181219" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Differences between the delta tables of HStore and column-store tables</caption><thead align="left"><tr id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_row1124662911122"><th align="left" class="cellrowborder" valign="top" width="24.18241824182418%" id="mcps1.3.4.2.2.4.1.1"><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p496775051213">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="42.484248424842484%" id="mcps1.3.4.2.2.4.1.2"><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1296765016126">Column-Store Delta Table</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.4.2.2.4.1.3"><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p149671550141213">HStore Delta Table</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_row7247142961218"><td class="cellrowborder" valign="top" width="24.18241824182418%" headers="mcps1.3.4.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p129681450151216">Table structure</p>
</td>
<td class="cellrowborder" valign="top" width="42.484248424842484%" headers="mcps1.3.4.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p16968195021210">Same as that defined for the column-store primary table.</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p4968250171211">Different from that defined for the primary table.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_row724720297124"><td class="cellrowborder" valign="top" width="24.18241824182418%" headers="mcps1.3.4.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1996813507124">Function</p>
</td>
<td class="cellrowborder" valign="top" width="42.484248424842484%" headers="mcps1.3.4.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p18968115041219">Used to temporarily store a small batch of inserted data. After the data size reaches the threshold, the data will be merged to the primary table. In this way, data will not be directly inserted to the primary table or generate a large number of small CUs.</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p596885015121">Persistently stores UPDATE, DELETE, and INSERT information. It is used to restore the memory structure that manages concurrent updates, such as the memory update chain, in the case of a fault.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_row0248162914126"><td class="cellrowborder" valign="top" width="24.18241824182418%" headers="mcps1.3.4.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1796835011125">Weakness</p>
</td>
<td class="cellrowborder" valign="top" width="42.484248424842484%" headers="mcps1.3.4.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p169681650141217">If data is not merged in a timely manner, the delta table will grow large and affect query performance. In addition, the table cannot solve lock conflicts during concurrent updates.</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.4.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p49681503127">The merge operation depends on the background AUTOVACUUM.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_s1a0c1ce222bb46dfb68a016610aea3a5"><h4 class="sectiontitle">Parameters</h4><ul id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_u4a81a0d707ae45068ea150166c1b249d"><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_lc929efc9948741d3a177e98a1aefbbe4"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_ac4c814ddf6754cd98d7ea10b7d3471f4">IF NOT EXISTS</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a907e52a2875c4303b296eb9192898111">If <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b5633478852425">IF NOT EXISTS</strong> is specified, a table will be created if there is no table using the specified name. If there is already a table using the specified name, no error will be reported. A message will be displayed indicating that the table already exists, and the database will skip table creation.</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_lcacb45adeaab4dc690fff7670c8f1068"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_accc4048091f74784a4329b2cff3870a2">table_name</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a69479c547933434eb9ef0c547a2090dc">Specifies the name of the table to be created.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p2293122101411">The table name can contain a maximum of 63 characters, including letters, digits, underscores (_), dollar signs ($), and number signs (#). It must start with a letter or underscore (_).</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l9617e926aec24a75b2c2472789705e99"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a114c6e26ec294f52a3fd16a29bb91ae6">column_name</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a77a2b66dd4fa4e4099ffaa5c2233ffdb">Specifies the name of a column to be created in the new table.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p231214106142">The column name can contain a maximum of 63 characters, including letters, digits, underscores (_), dollar signs ($), and number signs (#). It must start with a letter or underscore (_).</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l34f1a566739c48b4be821481538f5b81"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_abf296480d6a249bfb6cf296a54adef2a">data_type</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a2f57ce2d5cdb4c4d82556493aca949db">Specifies the data type of the column.</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l9f8eff5559b14ec7a69c0966fd7ebeae"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_aac04cbe8532f40a4a75f915be05075d6">LIKE source_table [ like_option ... ]</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p145084685114">Specifies a table from which the new table automatically copies all column names and their data types.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p115114615120">The new table and the original table are decoupled after creation is complete. Changes to the original table will not be applied to the new table, and scans on the original table will not be performed on the data of the new table.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p13511146155118">Columns copied by <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b16149691852425">LIKE</strong> are not merged with the same name. If the same name is specified explicitly or in another <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b153708355952425">LIKE</strong> clause, an error will be reported.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p125164610514">HStore tables can be inherited only from HStore tables.</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l4af34b084f7c4b1a96c37516810dc04d"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a2761a7089649476bbf0299a61e9f23da">WITH ( { storage_parameter = value } [, ... ] )</strong><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_ac10e4ce413a0489b927941d4d9e1e18e">Specifies an optional storage parameter for a table.</p>
<ul id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_u3170c562e94a492897636fbfcbcfb2b5"><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_le578deaf72b64b2fba7c1ae284e30b15">ORIENTATION<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1553593020546"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_le578deaf72b64b2fba7c1ae284e30b15"></a><a name="en-us_topic_0000001492558221_le578deaf72b64b2fba7c1ae284e30b15"></a>Specifies the storage mode (time series, row-store, or column-store) of table data. This parameter cannot be modified once it is set. For HStore tables, use the column storage mode and set <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b137816231888">enable_hstore</strong> to <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b37811223485">on</strong>.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p13535193085414">Options:</p>
<ul id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_ul105351630185419"><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li4535330145417"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b181633666552425">TIMESERIES</strong> indicates that the data is stored in time series.</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li14535123011547"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b53576484552425">COLUMN</strong> indicates that the data is stored in columns.</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li353614303549"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b201833204852425">ROW</strong> indicates that table data is stored in rows.</li></ul>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p4536630185415">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b7527953252425">ROW</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l770ea1d44c9f44bf8d17c8cb0a26bac6">COMPRESSION<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1652932165514"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l770ea1d44c9f44bf8d17c8cb0a26bac6"></a><a name="en-us_topic_0000001492558221_l770ea1d44c9f44bf8d17c8cb0a26bac6"></a>Specifies the compression level of the table data. It determines the compression ratio and time. Generally, a higher compression level indicates a higher compression ratio and a longer compression time, and vice versa. The actual compression ratio depends on the distribution characteristics of loading table data.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p5530721155514">Options:</p>
<ul id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_ul953062165514"><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li15306217556">The valid values for HStore tables and column-store tables are <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b1427295202712">YES</strong>/<strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b1827225142710">NO</strong> and <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b1627311516277">LOW</strong>/<strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b192730572720">MIDDLE</strong>/<strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b627310515274">HIGH</strong>, and the default is <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b227411552720">LOW</strong>.</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li105306213553">The valid values for row-store tables are <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b184109525452425">YES</strong> and <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b69039844652425">NO</strong>, and the default is <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b167634862952425">NO</strong>.</li></ul>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l677fdcd156914cc8bdaaa4713c333b34">COMPRESSLEVEL<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p9463191111569"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l677fdcd156914cc8bdaaa4713c333b34"></a><a name="en-us_topic_0000001492558221_l677fdcd156914cc8bdaaa4713c333b34"></a>Specifies table data compression rate and duration at the same compression level. This divides a compression level into sub-levels, providing you with more choices for compression ratio and duration. As the value becomes greater, the compression rate becomes higher and duration longer at the same compression level. The parameter is only valid for time series tables and column-store tables.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p7999121210374">Value range: 0 to 3</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_a50ebabc106f1448c95d6b1c810e1aa48">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b102365955952425">0</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_lff6a2288b8ec472993acbcf2b2d7c984">MAX_BATCHROW<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p19221142218578"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_lff6a2288b8ec472993acbcf2b2d7c984"></a><a name="en-us_topic_0000001492558221_lff6a2288b8ec472993acbcf2b2d7c984"></a>Specifies the maximum number of rows in a storage unit during data loading. The parameter is only valid for time series tables and column-store tables.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p1622172295718">Value range: 10000 to 60000</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p152212221575">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b19095098352425">60000</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l09d7b9048bcd4612a7e3529d8597419f">PARTIAL_CLUSTER_ROWS<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p13876122725814"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_l09d7b9048bcd4612a7e3529d8597419f"></a><a name="en-us_topic_0000001492558221_l09d7b9048bcd4612a7e3529d8597419f"></a>Specifies the number of records to be partially clustered for storage during data loading. The parameter is only valid for time series tables and column-store tables.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_ad566fbb5176e467cbcaafdd158c25afc">Value range: 600000 to 2147483647</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li2613194271216">enable_delta<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p10581175919589"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li2613194271216"></a><a name="en-us_topic_0000001492558221_li2613194271216"></a>Specifies whether to enable delta tables in column-store tables. This parameter cannot be enabled for HStore tables.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p561354210126">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b195932169852425">off</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li14799353420">SUB_PARTITION_COUNT<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p163480381049"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li14799353420"></a><a name="en-us_topic_0000001492558221_li14799353420"></a>Specifies the number of level-2 partitions. This parameter specifies the number of level-2 partitions during data import. This parameter is configured during table creation and cannot be modified after table creation. You are not advised to set the default value, which may affect the import and query performance.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p199484469413">Value range: 1 to 1024</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p934811381419">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b152552982552425">32</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li58771571744">DELTAROW_THRESHOLD<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p91349419513"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li58771571744"></a><a name="en-us_topic_0000001492558221_li58771571744"></a>Specifies the maximum number of rows (<strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b3781990291">SUB_PARTITION_COUNT</strong> x <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b284531222913">DELTAROW_THRESHOLD</strong>) to be imported to the delta table.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p213413415514">Value range: 0 to 60000</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p19134341557">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b10389163342916">60000</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li1498332517">COLVERSION<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p139121435651"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li1498332517"></a><a name="en-us_topic_0000001492558221_li1498332517"></a>Specifies the version of the storage format. HStore tables support only version 2.0.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p491215351519">Options:</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p199121535556"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b50507184252425">1.0</strong>: Each column in a column-store table is stored in a separate file. The file name is <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b140041634652425">relfilenode.C1.0</strong>, <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b62235372152425">relfilenode.C2.0</strong>, <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b92767111252425">relfilenode.C3.0</strong>, or similar.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p59128351510"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b18481036052425">2.0</strong>: All columns of a column-store table are combined and stored in a file. The file is named <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b169588996552425">relfilenode.C1.0</strong>.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p159125351758">Default value: <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b91050357852425">2.0</strong></p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li18672109269">DISTRIBUTE BY<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p575922512612"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li18672109269"></a><a name="en-us_topic_0000001492558221_li18672109269"></a>Specifies how the table is distributed or replicated between DNs.</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p47592255610">Options:</p>
<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p875919251266"><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b171125544052425">HASH (column_name)</strong>: Each row of the table will be placed into all the DNs based on the hash value of the specified column.</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li32928281810">TO { GROUP groupname | NODE ( nodename [, ... ] ) }<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p915013418811"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li32928281810"></a><a name="en-us_topic_0000001492558221_li32928281810"></a><strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b49995976452425">TO GROUP</strong> specifies the Node Group in which the table is created. Currently, it cannot be used for HDFS tables. <strong id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_b161094630152425">TO NODE</strong> is used for internal scale-out tools.</p>
</li><li id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li168892591072">PARTITION BY<p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p772167786"><a name="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_li168892591072"></a><a name="en-us_topic_0000001492558221_li168892591072"></a>Specifies the initial partition of an HStore table.</p>
</li></ul>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_sef6ec3dbbd444574a4075d7da04ff7ed"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_p19961111437">Create a simple HStore table.</p>
<pre class="screen" id="EN-US_TOPIC_0000001809519832__en-us_topic_0000001492558221_screen14571400469">CREATE TABLE warehouse_t1
(
W_WAREHOUSE_SK INTEGER NOT NULL,
W_WAREHOUSE_ID CHAR(16) NOT NULL,
W_WAREHOUSE_NAME VARCHAR(20) ,
W_WAREHOUSE_SQ_FT INTEGER ,
W_STREET_NUMBER CHAR(10) ,
W_STREET_NAME VARCHAR(60) ,
W_STREET_TYPE CHAR(15) ,
W_SUITE_NUMBER CHAR(10) ,
W_CITY VARCHAR(60) ,
W_COUNTY VARCHAR(30) ,
W_STATE CHAR(2) ,
W_ZIP CHAR(10) ,
W_COUNTRY VARCHAR(20) ,
W_GMT_OFFSET DECIMAL(5,2)
)WITH(ORIENTATION=COLUMN, ENABLE_HSTORE=ON);
CREATE TABLE warehouse_t2 (LIKE warehouse_t1 INCLUDING ALL);</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_04_1026.html">Hybrid Data Warehouse Syntax</a></div>
</div>
</div>