forked from docs/doc-exports
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>
45 lines
4.3 KiB
HTML
45 lines
4.3 KiB
HTML
<a name="EN-US_TOPIC_0000001444998754"></a><a name="EN-US_TOPIC_0000001444998754"></a>
|
||
|
||
<h1 class="topictitle1">Partition Management Function</h1>
|
||
<div id="body0000001444998754"><div class="section" id="EN-US_TOPIC_0000001444998754__section9462151915274"><a name="EN-US_TOPIC_0000001444998754__section9462151915274"></a><a name="section9462151915274"></a><h4 class="sectiontitle">proc_add_partition (relname regclass, boundaries_interval interval)</h4><p id="EN-US_TOPIC_0000001444998754__p148471314103918">Description: Adds partitions to a table with the automatic partition creation function enabled.</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p17847111413916">Return type: void</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p17847914183913">Note: When the function is executed, multiple partitions with time range as <strong id="EN-US_TOPIC_0000001444998754__b67582920494356">boundaries_interval</strong> are created based on the existing partition boundary until <strong id="EN-US_TOPIC_0000001444998754__b41472659194356">new_part_boundary – now_time >= 29 * boundaries_interval</strong>. Then, an extra partition is created to ensure that at least a new partition is created when the function is executed.</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p28471614153910">Example:</p>
|
||
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001444998754__screen78471314163918"><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></pre></div></td><td class="code"><div><pre><span></span><span class="k">call</span><span class="w"> </span><span class="n">proc_add_partition</span><span class="p">(</span><span class="s1">'my_schema.my_table'</span><span class="p">,</span><span class="w"> </span><span class="nb">interval</span><span class="w"> </span><span class="s1">'1 day'</span><span class="p">);</span>
|
||
<span class="w"> </span><span class="n">proc_add_partition</span>
|
||
<span class="c1">--------------------</span>
|
||
|
||
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
||
</pre></div></td></tr></table></div>
|
||
|
||
</div>
|
||
</div>
|
||
<div class="section" id="EN-US_TOPIC_0000001444998754__section9128833152714"><a name="EN-US_TOPIC_0000001444998754__section9128833152714"></a><a name="section9128833152714"></a><h4 class="sectiontitle">proc_drop_partition (relname regclass, older_than interval)</h4><p id="EN-US_TOPIC_0000001444998754__p3490183952212">Description: Deletes partitions from a table with the automatic partition deletion function enabled.</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p104908393225">Return type: void</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p897954015365">Note: When this function is executed, all partitions in the table are traversed and the partitions whose boundary is smaller than <strong id="EN-US_TOPIC_0000001444998754__b91990307294356">now_time - older_than</strong> are deleted. If all partitions meet the deletion condition, the table is truncated with one partition kept.</p>
|
||
<p id="EN-US_TOPIC_0000001444998754__p18490539142211">Example:</p>
|
||
<div class="codecoloring" codetype="Sql" id="EN-US_TOPIC_0000001444998754__screen104901396223"><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></pre></div></td><td class="code"><div><pre><span></span><span class="k">call</span><span class="w"> </span><span class="n">proc_drop_partition</span><span class="p">(</span><span class="s1">'my_schema.my_table'</span><span class="p">,</span><span class="w"> </span><span class="nb">interval</span><span class="w"> </span><span class="s1">'7 day'</span><span class="p">);</span>
|
||
<span class="w"> </span><span class="n">proc_drop_partition</span>
|
||
<span class="c1">--------------------</span>
|
||
|
||
<span class="p">(</span><span class="mi">1</span><span class="w"> </span><span class="k">row</span><span class="p">)</span>
|
||
</pre></div></td></tr></table></div>
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div>
|
||
<div class="familylinks">
|
||
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_06_0058.html">Database Object Functions</a></div>
|
||
</div>
|
||
</div>
|
||
|