forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: luhuayi <luhuayi@huawei.com> Co-committed-by: luhuayi <luhuayi@huawei.com>
220 lines
50 KiB
HTML
220 lines
50 KiB
HTML
<a name="EN-US_TOPIC_0000001764650772"></a><a name="EN-US_TOPIC_0000001764650772"></a>
|
|
|
|
<h1 class="topictitle1">CREATE TABLE</h1>
|
|
<div id="body0000001492558221"><div class="section" id="EN-US_TOPIC_0000001764650772__sf337ecb5bde84580afed94be7bbf5fb9"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001764650772__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_0000001764650772__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_0000001764650772__b104571410112714">enable_hstore</strong> to <strong id="EN-US_TOPIC_0000001764650772__b04571110192711">on</strong> and set <strong id="EN-US_TOPIC_0000001764650772__b15457151072711">orientation</strong> to <strong id="EN-US_TOPIC_0000001764650772__b144571510102716">column</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p617551214318">To enhance performance, GaussDB(DWS) 9.1.0 and later versions have optimized HStore tables and kept the old ones for compatibility purposes. The optimized tables are known as HStore Opt tables. HStore tables can be replaced by HStore Opt tables for better performance, except in scenarios requiring high performance without micro-batch updates.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001764650772__s0c57396ef17642e9a39a88ab766472e1"><h4 class="sectiontitle">Precautions</h4><ul id="EN-US_TOPIC_0000001764650772__u833942a091c642dba1f12f016ec573a6"><li id="EN-US_TOPIC_0000001764650772__li1685418345272">When creating an HStore table, ensure that the database GUC parameter settings meet the following requirements:<ul id="EN-US_TOPIC_0000001764650772__ul822142062019"><li id="EN-US_TOPIC_0000001764650772__li15221142012019"><strong id="EN-US_TOPIC_0000001764650772__b1873618222384">autovacuum</strong> is set to <strong id="EN-US_TOPIC_0000001764650772__b14737122123818">on</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li2221620102016">The value of autovacuum_max_workers_hstore is greater than <strong id="EN-US_TOPIC_0000001764650772__b1593132793810">0</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li162211720202019">The value of autovacuum_max_workers is greater than that of <strong id="EN-US_TOPIC_0000001764650772__b1676163073810">autovacuum_max_workers_hstore</strong>.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li10869171163914">To create an HStore table, you must have the <strong id="EN-US_TOPIC_0000001764650772__b7783144910229">USAGE</strong> permission on schema cstore.</li><li id="EN-US_TOPIC_0000001764650772__li168691211123910">The table-level parameters <strong id="EN-US_TOPIC_0000001764650772__b198331944181717">enable_delta</strong> and <strong id="EN-US_TOPIC_0000001764650772__b1815294615173">enable_hstore</strong> cannot be enabled at the same time. The parameter <strong id="EN-US_TOPIC_0000001764650772__b67571335183">enable_delta</strong> is used to enable delta for common column-store tables and conflicts with <strong id="EN-US_TOPIC_0000001764650772__b109122819187">enable_hstore</strong>.</li><li id="EN-US_TOPIC_0000001764650772__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_0000001764650772__b11921615122114">reldeltaidx</strong> field in <strong id="EN-US_TOPIC_0000001764650772__b179831161214">pg_class</strong>. (The <strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__s24f4eafc7fd349969c837eaaf863b260"><h4 class="sectiontitle">Syntax</h4><div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001764650772__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_0000001764650772__section12566103412113"><h4 class="sectiontitle">Differences Between Delta Tables</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001764650772__table13918115812260" 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_0000001764650772__row6918858132614"><th align="left" class="cellrowborder" valign="top" width="10.979999999999999%" id="mcps1.3.4.2.2.5.1.1"><p id="EN-US_TOPIC_0000001764650772__p1591819583261">Type</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="27.800000000000004%" id="mcps1.3.4.2.2.5.1.2"><p id="EN-US_TOPIC_0000001764650772__p59198582262">Column-Store Delta Table</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="30.490000000000002%" id="mcps1.3.4.2.2.5.1.3"><p id="EN-US_TOPIC_0000001764650772__p49195584264">HStore Delta Table</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="30.73%" id="mcps1.3.4.2.2.5.1.4"><p id="EN-US_TOPIC_0000001764650772__p18919175813262">HStore Opt Delta Table</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001764650772__row179193582269"><td class="cellrowborder" valign="top" width="10.979999999999999%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p2919105820260">Table structure</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.800000000000004%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001764650772__p1891914582261">Same as that defined for the column-store primary table.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.490000000000002%" headers="mcps1.3.4.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001764650772__p59191758142613">Different from that defined for the primary table.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.73%" headers="mcps1.3.4.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001764650772__p13919195862614">Different from the definitions of the primary table and but same as the definitions of the HStore table.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764650772__row5919958162618"><td class="cellrowborder" valign="top" width="10.979999999999999%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p59191258162616">Functionality</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.800000000000004%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001764650772__p4919958132611">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="30.490000000000002%" headers="mcps1.3.4.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001764650772__p1192055822614">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>
|
|
<td class="cellrowborder" valign="top" width="30.73%" headers="mcps1.3.4.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001764650772__p13920458102612">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. It is further optimized compared with HStore.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764650772__row1892025814262"><td class="cellrowborder" valign="top" width="10.979999999999999%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p7920105815266">Weakness</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.800000000000004%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001764650772__p11920358162615">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="30.490000000000002%" headers="mcps1.3.4.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001764650772__p592055872612">The merge operation depends on the background AUTOVACUUM.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.73%" headers="mcps1.3.4.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001764650772__p39202058182613">The merge operation depends on the background AUTOVACUUM.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764650772__row10920135810268"><td class="cellrowborder" valign="top" width="10.979999999999999%" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p292055819264">Specification differences</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="27.800000000000004%" headers="mcps1.3.4.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001764650772__p7138193591">Concurrent requests in the same CU are not supported. It is applicable to the scenario where there are not many concurrent updates.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p5753113715491"></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.490000000000002%" headers="mcps1.3.4.2.2.5.1.3 "><ol id="EN-US_TOPIC_0000001764650772__ol1799616347579"><li id="EN-US_TOPIC_0000001764650772__li129961834105712">Insertion and update restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul9867115010014"><li id="EN-US_TOPIC_0000001764650772__li104461381014"><strong id="EN-US_TOPIC_0000001764650772__b1034429144216">MERGE INTO</strong> does not support concurrent updates of the same row or repeated updates of the same key.</li><li id="EN-US_TOPIC_0000001764650772__li184462383019">Concurrent UPDATE or DELETE operations on the same row are not supported. Otherwise, an error is reported.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li540614338018">Index and query restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul54467381901"><li id="EN-US_TOPIC_0000001764650772__li1444616388014">Indexes do not support array condition filtering, <strong id="EN-US_TOPIC_0000001764650772__b517754124317">IN</strong> expression filtering, partial indexes, or expression indexes.</li><li id="EN-US_TOPIC_0000001764650772__li194461385015">Indexes cannot be invalidated.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li244613813014">Table structure and operation restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul93691306120"><li id="EN-US_TOPIC_0000001764650772__li1336917012112">Ensure that the tables to be exchanged are HStore tables during partition exchange or relfilenode operations.</li><li id="EN-US_TOPIC_0000001764650772__li1953110411898">The distribution column cannot be modified using the <strong id="EN-US_TOPIC_0000001764650772__b47831140144316">UPDATE</strong> command. You are not advised to modify the partition column using the <strong id="EN-US_TOPIC_0000001764650772__b103931125105312">UPDATE</strong> command. (No error is reported, but the performance is poor.)</li></ul>
|
|
</li></ol>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="30.73%" headers="mcps1.3.4.2.2.5.1.4 "><ol id="EN-US_TOPIC_0000001764650772__ol56930652"><li id="EN-US_TOPIC_0000001764650772__li76143010520">Insertion and update restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul12316184620515"><li id="EN-US_TOPIC_0000001764650772__li13316184615511"><strong id="EN-US_TOPIC_0000001764650772__b10491727185411">MERGE INTO</strong> does not support concurrent updates of the same row or repeated updates of the same key.</li><li id="EN-US_TOPIC_0000001764650772__li1231664615510">Concurrent updates or deletions of the same row is not supported.</li><li id="EN-US_TOPIC_0000001764650772__li120473518811"><strong id="EN-US_TOPIC_0000001764650772__b9724325751084">hstore_opt</strong> does not support cross-partition upserts.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li47981435856">Index and query restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul1954917321774"><li id="EN-US_TOPIC_0000001764650772__li14198113615718">Bitmap indexes are supported.</li><li id="EN-US_TOPIC_0000001764650772__li11635144210719">Global dictionaries are supported.</li><li id="EN-US_TOPIC_0000001764650772__li155558553718"><strong id="EN-US_TOPIC_0000001764650772__b21098748361084">bitmap_columns</strong> must be specified during table creation and cannot be modified after being set.</li><li id="EN-US_TOPIC_0000001764650772__li248014011255">The opt version does not support transparent parameter transmission during SMP streaming. In multi-table join queries that require partition pruning, avoid using replicated tables or setting <strong id="EN-US_TOPIC_0000001764650772__b9483496751084">query_dop</strong>.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li363912503615">Table structure and operation restrictions:<ul id="EN-US_TOPIC_0000001764650772__ul159572020171013"><li id="EN-US_TOPIC_0000001764650772__li395714201105">Distribution columns and partition columns cannot be modified using <strong id="EN-US_TOPIC_0000001764650772__b17676105411566">UPDATE</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li521195411111">The <strong id="EN-US_TOPIC_0000001764650772__b14430743351084">enable_hstore_opt</strong> attribute must be set when the table is created and cannot be changed after being set.</li></ul>
|
|
</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764650772__row3923175818262"><td class="cellrowborder" valign="top" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p1192345813266">Data import suggestions</p>
|
|
</td>
|
|
<td class="cellrowborder" colspan="3" valign="top" headers="mcps1.3.4.2.2.5.1.2 mcps1.3.4.2.2.5.1.3 mcps1.3.4.2.2.5.1.4 "><ol id="EN-US_TOPIC_0000001764650772__ol6203193914429"><li id="EN-US_TOPIC_0000001764650772__li120313911424">For optimal data import, query performance, and space utilization, it is recommended to choose the HStore Opt table. In scenarios involving micro-batch copying with high performance demands and no data updates, you can choose the HStore table.</li><li id="EN-US_TOPIC_0000001764650772__li8418149144213">Similarities between HStore and HStore Opt tables:<ul id="EN-US_TOPIC_0000001764650772__ul16056983018"><li id="EN-US_TOPIC_0000001764650772__li106059963014">The performance of importing data using <strong id="EN-US_TOPIC_0000001764650772__b03293207220">UPDATE</strong> is poor. You are advised to use <strong id="EN-US_TOPIC_0000001764650772__b0330420323">UPSERT</strong> to import data.</li><li id="EN-US_TOPIC_0000001764650772__li5605893306">When using <strong id="EN-US_TOPIC_0000001764650772__b1152525522">DELETE</strong> to import data, use index scanning. The <strong id="EN-US_TOPIC_0000001764650772__b171531325325">JDBC batch</strong> method is recommended.</li><li id="EN-US_TOPIC_0000001764650772__li560539153013">Use <strong id="EN-US_TOPIC_0000001764650772__b1736383115414">MERGE INTO</strong> to import data records to the database when the data volume exceeds 1 million per DN and there is no concurrent data.</li><li id="EN-US_TOPIC_0000001764650772__li623993813115">Do not modify or add data in cold partitions.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li1694919565434">Suggestions on HStore table data import using <strong id="EN-US_TOPIC_0000001764650772__b1066310012814">UPSERT</strong>:<ul id="EN-US_TOPIC_0000001764650772__ul126974345447"><li id="EN-US_TOPIC_0000001764650772__li7697534174415">Select a method.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001764650772__p18399446174018">Step 1: Select <a href="#EN-US_TOPIC_0000001764650772__li1853793155616">Method 2</a> for partial column upsert. For full column upsert (update all columns to new values without expressions when a conflict occurs), go to step 2.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p13399194617405">Step 2: Check whether data is concurrently updated to the same key when being imported to the database. If no conflict occurs, select <a href="#EN-US_TOPIC_0000001764650772__li13536163105610">Method 1</a>. If a conflict occurs, go to step 3.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p6399946124016">Step 3: If duplicate data exists in the database, select <a href="#EN-US_TOPIC_0000001764650772__li1853793155616">Method 2</a>. Otherwise, go to step 4.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p839994612402">Step 4: If copying of temporary tables is used for import, select <a href="#EN-US_TOPIC_0000001764650772__li95391035565">Method 3</a>. Otherwise, select <a href="#EN-US_TOPIC_0000001764650772__li1853793155616">Method 2</a>.</p>
|
|
<ul id="EN-US_TOPIC_0000001764650772__ul43231839164418"><li id="EN-US_TOPIC_0000001764650772__li4323103954410">The methods are as follows:<ul id="EN-US_TOPIC_0000001764650772__ul0941635619"><li id="EN-US_TOPIC_0000001764650772__li13536163105610"><a name="EN-US_TOPIC_0000001764650772__li13536163105610"></a><a name="li13536163105610"></a><strong id="EN-US_TOPIC_0000001764650772__b17121215141084">Method 1</strong>: Enable <strong id="EN-US_TOPIC_0000001764650772__b4230705621084">enable_hstore_nonconflict_upsert_optimization</strong> and disable <strong id="EN-US_TOPIC_0000001764650772__b6134408321084">enable_hstore_partial_upsert_optimization</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li1853793155616"><a name="EN-US_TOPIC_0000001764650772__li1853793155616"></a><a name="li1853793155616"></a><strong id="EN-US_TOPIC_0000001764650772__b12364716731084">Method 2</strong>: Disable <strong id="EN-US_TOPIC_0000001764650772__b4577329621084">enable_hstore_nonconflict_upsert_optimization</strong> and enable <strong id="EN-US_TOPIC_0000001764650772__b10597854921084">enable_hstore_partial_upsert_optimization</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li95391035565"><a name="EN-US_TOPIC_0000001764650772__li95391035565"></a><a name="li95391035565"></a><strong id="EN-US_TOPIC_0000001764650772__b16847796041084">Method 3</strong>: Disable <strong id="EN-US_TOPIC_0000001764650772__b17099105601084">enable_hstore_nonconflict_upsert_optimization</strong> and <strong id="EN-US_TOPIC_0000001764650772__b17382021041084">enable_hstore_partial_upsert_optimization</strong>.</li></ul>
|
|
</li></ul>
|
|
<ul id="EN-US_TOPIC_0000001764650772__ul6563134214443"><li id="EN-US_TOPIC_0000001764650772__li19649174454416">Note: If the number of accumulated batches is less than 2,000, import data in batches into the database. For accumulated batches exceeding 2,000, import data into the database by copying temporary tables.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li2021912548441">Suggestions on HStore Opt table data import using <strong id="EN-US_TOPIC_0000001764650772__b1427554291617">UPSERT</strong>:<p id="EN-US_TOPIC_0000001764650772__p13464610451">If there is no concurrency conflict, enable the <strong id="EN-US_TOPIC_0000001764650772__b1257820971084">enable_hstore_nonconflict_upsert_optimization</strong> parameter. In other scenarios, disable the parameter. The optimal path is automatically selected.</p>
|
|
</li></ol>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0000001764650772__row9923458152617"><td class="cellrowborder" valign="top" headers="mcps1.3.4.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001764650772__p3923145882618">Point query suggestions</p>
|
|
</td>
|
|
<td class="cellrowborder" colspan="3" valign="top" headers="mcps1.3.4.2.2.5.1.2 mcps1.3.4.2.2.5.1.3 mcps1.3.4.2.2.5.1.4 "><ol id="EN-US_TOPIC_0000001764650772__ol8100102923814"><li id="EN-US_TOPIC_0000001764650772__li91007298384">Generally, the HStore Opt table is recommended for point queries.</li><li id="EN-US_TOPIC_0000001764650772__li203753328381">Similarities between HStore and HStore Opt tables:<p id="EN-US_TOPIC_0000001764650772__p84106317368"><a name="EN-US_TOPIC_0000001764650772__li203753328381"></a><a name="li203753328381"></a>Create a level-2 partition on the column where the equal-value filter condition is most frequently used and distinct values are evenly distributed.</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li20719162134013">Suggestions on using HStore tables for point queries:<ul id="EN-US_TOPIC_0000001764650772__ul211685114512"><li id="EN-US_TOPIC_0000001764650772__li10116145185112">Accelerating indexes other than primary keys may have poor effect. You are advised not to enable index acceleration.</li><li id="EN-US_TOPIC_0000001764650772__li8437175415513">If the data type is numeric or strings less than 16 bytes, Turbo acceleration is recommended.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li34261418184015">Suggestions on using HStore Opt tables:<ul id="EN-US_TOPIC_0000001764650772__ul16529949145316"><li id="EN-US_TOPIC_0000001764650772__li952904975320">For equal-value filter columns not in level-2 partitions, if the columns involved in the filter criteria are basically fixed in the query, use the CB-tree index. If the columns change continuously, you are advised to use the GIN index. Do not select more than five index columns.</li><li id="EN-US_TOPIC_0000001764650772__li205295498531">For all string columns involving equivalent filtering, bitmap indexes can be specified during table creation. The number of columns is not limited, but cannot be modified later.</li><li id="EN-US_TOPIC_0000001764650772__li5529184945312">Specify columns that can be filtered by time range as the partition columns.</li><li id="EN-US_TOPIC_0000001764650772__li15301949205310">If the number of returned data records exceeds 100,000 per DN, index scanning may not significantly enhance performance. In this case, you are advised to use the GUC parameter <strong id="EN-US_TOPIC_0000001764650772__b2404296331084">enable_seqscan</strong> to test the performance then determine which optimization method to use.</li></ul>
|
|
</li></ol>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001764650772__s1a0c1ce222bb46dfb68a016610aea3a5"><h4 class="sectiontitle">Parameters</h4><ul id="EN-US_TOPIC_0000001764650772__u4a81a0d707ae45068ea150166c1b249d"><li id="EN-US_TOPIC_0000001764650772__lc929efc9948741d3a177e98a1aefbbe4"><strong id="EN-US_TOPIC_0000001764650772__ac4c814ddf6754cd98d7ea10b7d3471f4">IF NOT EXISTS</strong><p id="EN-US_TOPIC_0000001764650772__a907e52a2875c4303b296eb9192898111">If <strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__lcacb45adeaab4dc690fff7670c8f1068"><strong id="EN-US_TOPIC_0000001764650772__accc4048091f74784a4329b2cff3870a2">table_name</strong><p id="EN-US_TOPIC_0000001764650772__a69479c547933434eb9ef0c547a2090dc">Specifies the name of the table to be created.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__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_0000001764650772__l9617e926aec24a75b2c2472789705e99"><strong id="EN-US_TOPIC_0000001764650772__a114c6e26ec294f52a3fd16a29bb91ae6">column_name</strong><p id="EN-US_TOPIC_0000001764650772__a77a2b66dd4fa4e4099ffaa5c2233ffdb">Specifies the name of a column to be created in the new table.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__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_0000001764650772__l34f1a566739c48b4be821481538f5b81"><strong id="EN-US_TOPIC_0000001764650772__abf296480d6a249bfb6cf296a54adef2a">data_type</strong><p id="EN-US_TOPIC_0000001764650772__a2f57ce2d5cdb4c4d82556493aca949db">Specifies the data type of the column.</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__l9f8eff5559b14ec7a69c0966fd7ebeae"><strong id="EN-US_TOPIC_0000001764650772__aac04cbe8532f40a4a75f915be05075d6">LIKE source_table [ like_option ... ]</strong><p id="EN-US_TOPIC_0000001764650772__p145084685114">Specifies a table from which the new table automatically copies all column names and their data types.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__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_0000001764650772__p13511146155118">Columns copied by <strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__b153708355952425">LIKE</strong> clause, an error will be reported.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p125164610514">HStore tables can be inherited only from HStore tables.</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__l4af34b084f7c4b1a96c37516810dc04d"><strong id="EN-US_TOPIC_0000001764650772__a2761a7089649476bbf0299a61e9f23da">WITH ( { storage_parameter = value } [, ... ] )</strong><p id="EN-US_TOPIC_0000001764650772__ac10e4ce413a0489b927941d4d9e1e18e">Specifies an optional storage parameter for a table.</p>
|
|
<ul id="EN-US_TOPIC_0000001764650772__u3170c562e94a492897636fbfcbcfb2b5"><li id="EN-US_TOPIC_0000001764650772__le578deaf72b64b2fba7c1ae284e30b15">ORIENTATION<p id="EN-US_TOPIC_0000001764650772__p1553593020546"><a name="EN-US_TOPIC_0000001764650772__le578deaf72b64b2fba7c1ae284e30b15"></a><a name="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_0000001764650772__b1690819123265">enable_hstore</strong> to <strong id="EN-US_TOPIC_0000001764650772__b17990813142617">on</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p13535193085414">Options:</p>
|
|
<ul id="EN-US_TOPIC_0000001764650772__ul105351630185419"><li id="EN-US_TOPIC_0000001764650772__li4535330145417"><strong id="EN-US_TOPIC_0000001764650772__b181633666552425">TIMESERIES</strong> indicates that the data is stored in time series.</li><li id="EN-US_TOPIC_0000001764650772__li14535123011547"><strong id="EN-US_TOPIC_0000001764650772__b53576484552425">COLUMN</strong> indicates that the data is stored in columns.</li><li id="EN-US_TOPIC_0000001764650772__li353614303549"><strong id="EN-US_TOPIC_0000001764650772__b201833204852425">ROW</strong> indicates that table data is stored in rows.</li></ul>
|
|
<p id="EN-US_TOPIC_0000001764650772__p4536630185415">Default value: <strong id="EN-US_TOPIC_0000001764650772__b7527953252425">ROW</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__l770ea1d44c9f44bf8d17c8cb0a26bac6">COMPRESSION<p id="EN-US_TOPIC_0000001764650772__p1652932165514"><a name="EN-US_TOPIC_0000001764650772__l770ea1d44c9f44bf8d17c8cb0a26bac6"></a><a name="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_0000001764650772__p5530721155514">Options:</p>
|
|
<ul id="EN-US_TOPIC_0000001764650772__ul953062165514"><li id="EN-US_TOPIC_0000001764650772__li15306217556">The valid values for HStore tables and column-store tables are <strong id="EN-US_TOPIC_0000001764650772__b1427295202712">YES</strong>/<strong id="EN-US_TOPIC_0000001764650772__b1827225142710">NO</strong> and <strong id="EN-US_TOPIC_0000001764650772__b1627311516277">LOW</strong>/<strong id="EN-US_TOPIC_0000001764650772__b192730572720">MIDDLE</strong>/<strong id="EN-US_TOPIC_0000001764650772__b627310515274">HIGH</strong>, and the default is <strong id="EN-US_TOPIC_0000001764650772__b227411552720">LOW</strong>.</li><li id="EN-US_TOPIC_0000001764650772__li105306213553">The valid values for row-store tables are <strong id="EN-US_TOPIC_0000001764650772__b184109525452425">YES</strong> and <strong id="EN-US_TOPIC_0000001764650772__b69039844652425">NO</strong>, and the default is <strong id="EN-US_TOPIC_0000001764650772__b167634862952425">NO</strong>.</li></ul>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__l677fdcd156914cc8bdaaa4713c333b34">COMPRESSLEVEL<p id="EN-US_TOPIC_0000001764650772__p9463191111569"><a name="EN-US_TOPIC_0000001764650772__l677fdcd156914cc8bdaaa4713c333b34"></a><a name="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_0000001764650772__p7999121210374">Value range: 0 to 3</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__a50ebabc106f1448c95d6b1c810e1aa48">Default value: <strong id="EN-US_TOPIC_0000001764650772__b102365955952425">0</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__lff6a2288b8ec472993acbcf2b2d7c984">MAX_BATCHROW<p id="EN-US_TOPIC_0000001764650772__p19221142218578"><a name="EN-US_TOPIC_0000001764650772__lff6a2288b8ec472993acbcf2b2d7c984"></a><a name="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_0000001764650772__p1622172295718">Value range: 10000 to 60000</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p152212221575">Default value: <strong id="EN-US_TOPIC_0000001764650772__b14430658132720">60000</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__l09d7b9048bcd4612a7e3529d8597419f">PARTIAL_CLUSTER_ROWS<p id="EN-US_TOPIC_0000001764650772__p13876122725814"><a name="EN-US_TOPIC_0000001764650772__l09d7b9048bcd4612a7e3529d8597419f"></a><a name="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_0000001764650772__ad566fbb5176e467cbcaafdd158c25afc">Value range: 600000 to 2147483647</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li2613194271216">enable_delta<p id="EN-US_TOPIC_0000001764650772__p10581175919589"><a name="EN-US_TOPIC_0000001764650772__li2613194271216"></a><a name="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_0000001764650772__p561354210126">Default value: <strong id="EN-US_TOPIC_0000001764650772__b195932169852425">off</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li4236202164514">enable_hstore<p id="EN-US_TOPIC_0000001764650772__p22361025458"><a name="EN-US_TOPIC_0000001764650772__li4236202164514"></a><a name="li4236202164514"></a>Specifies whether to create a table as an HStore table (based on column-store tables). The parameter is only valid for column-store tables. This parameter is supported by version 8.2.0.100 or later clusters.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p13236520457">Default value: <strong id="EN-US_TOPIC_0000001764650772__b190618195">off</strong></p>
|
|
<div class="note" id="EN-US_TOPIC_0000001764650772__note1034095181611"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0000001764650772__p644992824620">If this parameter is enabled, the following GUC parameters must be set to ensure that HStore tables are cleared.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p193173119500"><strong id="EN-US_TOPIC_0000001764650772__b10797357825">autovacuum</strong>=<strong id="EN-US_TOPIC_0000001764650772__b207201111138">true</strong>, <strong id="EN-US_TOPIC_0000001764650772__b1748414739">autovacuum_max_workers</strong>=<strong id="EN-US_TOPIC_0000001764650772__b292626032">6</strong>, <strong id="EN-US_TOPIC_0000001764650772__b132581996316">autovacuum_max_workers_hstore</strong>=<strong id="EN-US_TOPIC_0000001764650772__b101748121139">3</strong>.</p>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li1731172013545">enable_disaster_cstore<p id="EN-US_TOPIC_0000001764650772__p431132017546"><a name="EN-US_TOPIC_0000001764650772__li1731172013545"></a><a name="li1731172013545"></a>Specifies whether fine-grained DR will be enabled for column-store tables. This parameter only takes effect on column-store tables whose COLVERSION is 2.0 and cannot be set to <strong id="EN-US_TOPIC_0000001764650772__b652322790104122">on</strong> if <strong id="EN-US_TOPIC_0000001764650772__b1393422104104122">enable_hstore</strong> is <strong id="EN-US_TOPIC_0000001764650772__b1888132116104122">on</strong>. This parameter is supported by version 8.2.0.100 or later clusters.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p565948113317">Default value: <strong id="EN-US_TOPIC_0000001764650772__b864380402">off</strong></p>
|
|
<div class="caution" id="EN-US_TOPIC_0000001764650772__note10724155274012"><span class="cautiontitle"><img src="public_sys-resources/caution_3.0-en-us.png"> </span><div class="cautionbody"><p id="EN-US_TOPIC_0000001764650772__p87241552204011">Before enabling this function, set the GUC parameter <strong id="EN-US_TOPIC_0000001764650772__b7728174745512">enable_metadata_tracking</strong> to <strong id="EN-US_TOPIC_0000001764650772__b3159312095512">on</strong>. Otherwise, fine-grained DR may fail to be enabled.</p>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li14799353420">SUB_PARTITION_COUNT<p id="EN-US_TOPIC_0000001764650772__p163480381049"><a name="EN-US_TOPIC_0000001764650772__li14799353420"></a><a name="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_0000001764650772__p199484469413">Value range: 1 to 1024</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p934811381419">Default value: <strong id="EN-US_TOPIC_0000001764650772__b152552982552425">32</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li58771571744">DELTAROW_THRESHOLD<p id="EN-US_TOPIC_0000001764650772__p91349419513"><a name="EN-US_TOPIC_0000001764650772__li58771571744"></a><a name="li58771571744"></a>Specifies the maximum number of rows (<strong id="EN-US_TOPIC_0000001764650772__b3781990291">SUB_PARTITION_COUNT</strong> x <strong id="EN-US_TOPIC_0000001764650772__b284531222913">DELTAROW_THRESHOLD</strong>) to be imported to the delta table.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p213413415514">Value range: 0 to 60000</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p19134341557">Default value: <strong id="EN-US_TOPIC_0000001764650772__b178186113285">60000</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li1498332517">COLVERSION<p id="EN-US_TOPIC_0000001764650772__p139121435651"><a name="EN-US_TOPIC_0000001764650772__li1498332517"></a><a name="li1498332517"></a>Specifies the version of the storage format. HStore tables support only version 2.0, and <strong id="EN-US_TOPIC_0000001764650772__b1929214211587">enable_hstore_opt</strong> tables support versions 2.0 and 3.0.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p491215351519">Options:</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p199121535556"><strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__b140041634652425">relfilenode.C1.0</strong>, <strong id="EN-US_TOPIC_0000001764650772__b62235372152425">relfilenode.C2.0</strong>, <strong id="EN-US_TOPIC_0000001764650772__b92767111252425">relfilenode.C3.0</strong>, or similar.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p59128351510"><strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__b169588996552425">relfilenode.C1.0</strong>.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p159125351758">Default value: <strong id="EN-US_TOPIC_0000001764650772__b91050357852425">2.0</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li5857104533217">enable_binlog<p id="EN-US_TOPIC_0000001764650772__p244097173310"><a name="EN-US_TOPIC_0000001764650772__li5857104533217"></a><a name="li5857104533217"></a>Specifies whether to enable the binlog function for the HStore table. This parameter is supported only by clusters of version 9.1.0 or later.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p204401876333">Value range: <strong id="EN-US_TOPIC_0000001764650772__b144902532772213">on</strong> and <strong id="EN-US_TOPIC_0000001764650772__b208157126072213">off</strong></p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p20440137163314">Default value: <strong id="EN-US_TOPIC_0000001764650772__b1726419441">off</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li125481342133319"><a name="EN-US_TOPIC_0000001764650772__li125481342133319"></a><a name="li125481342133319"></a>enable_binlog_timestamp<p id="EN-US_TOPIC_0000001764650772__p105481042173319"><a name="EN-US_TOPIC_0000001764650772__li125481342133319"></a><a name="li125481342133319"></a>Determines whether to enable the binlog function with timestamps for HStore tables. This parameter and <strong id="EN-US_TOPIC_0000001764650772__b164911331206">enable_binlog</strong> cannot be enabled at the same time. Only clusters of 9.1.0.200 and later versions support this parameter.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p45481642133312">Value range: <strong id="EN-US_TOPIC_0000001764650772__b152399680472213">on</strong> and <strong id="EN-US_TOPIC_0000001764650772__b104676687272213">off</strong></p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p17549742173314">Default value: <strong id="EN-US_TOPIC_0000001764650772__b574371123">off</strong></p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li18672109269">DISTRIBUTE BY<p id="EN-US_TOPIC_0000001764650772__p575922512612"><a name="EN-US_TOPIC_0000001764650772__li18672109269"></a><a name="li18672109269"></a>Specifies how the table is distributed or replicated between DNs.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p47592255610">Options:</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p875919251266"><strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__li32928281810">TO { GROUP groupname | NODE ( nodename [, ... ] ) }<p id="EN-US_TOPIC_0000001764650772__p915013418811"><a name="EN-US_TOPIC_0000001764650772__li32928281810"></a><a name="li32928281810"></a><strong id="EN-US_TOPIC_0000001764650772__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_0000001764650772__b161094630152425">TO NODE</strong> is used for internal scale-out tools.</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li168892591072">PARTITION BY<p id="EN-US_TOPIC_0000001764650772__p772167786"><a name="EN-US_TOPIC_0000001764650772__li168892591072"></a><a name="li168892591072"></a>Specifies the initial partition of an HStore table.</p>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li462711582713">secondary_part_column<p id="EN-US_TOPIC_0000001764650772__p262820518275"><a name="EN-US_TOPIC_0000001764650772__li462711582713"></a><a name="li462711582713"></a>Specifies the name of a level-2 partition column in a column-store table. Only one column can be specified as the level-2 partition column. This parameter applies only to HStore column-store tables. This parameter is supported only by clusters of version 9.1.0 and later. V3 tables do not support this parameter and will use hashbucket pruning.</p>
|
|
<div class="note" id="EN-US_TOPIC_0000001764650772__note92691631163218"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001764650772__ul9661132315177"><li id="EN-US_TOPIC_0000001764650772__li146616237179">The column specified as a level-2 partition column cannot be deleted or modified.</li><li id="EN-US_TOPIC_0000001764650772__li11661102351718">The level-2 partition column can be specified only when a table is created. After a table is created, the level-2 partition column cannot be modified.</li><li id="EN-US_TOPIC_0000001764650772__li8661162315177">You are not advised to specify a distribution column as a level-2 partition column.</li><li id="EN-US_TOPIC_0000001764650772__li13661132313174">The level-2 partition column determines how the table is logically split into hash partitions on DNs, which enhances the query performance for that column.</li></ul>
|
|
</div></div>
|
|
</li><li id="EN-US_TOPIC_0000001764650772__li162691053518">secondary_part_num<p id="EN-US_TOPIC_0000001764650772__p13269120113518"><a name="EN-US_TOPIC_0000001764650772__li162691053518"></a><a name="li162691053518"></a>Specifies the number of level-2 partitions in a column-store table. This parameter applies only to HStore column-store tables. This parameter is supported only by clusters of version 9.1.0 and later. V3 tables do not support this parameter and will use hashbucket pruning.</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p2090765223614">Value range: 1 to 32</p>
|
|
<p id="EN-US_TOPIC_0000001764650772__p1759634323610">Default value: <strong id="EN-US_TOPIC_0000001764650772__b13396083693191">8</strong></p>
|
|
<div class="note" id="EN-US_TOPIC_0000001764650772__note169631149193711"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001764650772__ul13978135331914"><li id="EN-US_TOPIC_0000001764650772__li1197825316191">This parameter can be specified only when <strong id="EN-US_TOPIC_0000001764650772__b2092151031517">secondary_part_column</strong> is specified.</li><li id="EN-US_TOPIC_0000001764650772__li997865341913">The number of level-2 partitions can be specified only when a table is created and cannot be modified after the table is created.</li><li id="EN-US_TOPIC_0000001764650772__li14978165391912">You are not advised to change the default value, which may affect the import and query performance.</li></ul>
|
|
</div></div>
|
|
</li></ul>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001764650772__sef6ec3dbbd444574a4075d7da04ff7ed"><h4 class="sectiontitle">Example</h4><p id="EN-US_TOPIC_0000001764650772__p19961111437">Create a simple HStore Opt table.</p>
|
|
<pre class="screen" id="EN-US_TOPIC_0000001764650772__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_OPT=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>
|
|
|