doc-exports/docs/dws/tool/dws_16_0164.html
Lu, Huayi 27019c2991 DWS TOOL 830.201 version
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>
2024-05-16 07:35:25 +00:00

53 lines
6.0 KiB
HTML

<a name="EN-US_TOPIC_0000001819416249"></a><a name="EN-US_TOPIC_0000001819416249"></a>
<h1 class="topictitle1">Row-Store/Column-Store Table Compression</h1>
<div id="body8662426"><p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p993518218358">GaussDB(DWS) supports column-store table compression, but does not support row-store table compression. DSC performs migration based on GaussDB(DWS) features.</p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p15307105223719">Compression parameters:</p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p10151706188"><a href="dws_16_0016.html#EN-US_TOPIC_0000001772696060__en-us_topic_0000001706105077_en-us_topic_0000001434418777_li186211955102212">table.compress.mode.</a> If keyword <strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b208709080632050">COMPRESS</strong> is specified in <strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b43269407432050">CREATE TABLE</strong>, the compression feature will be triggered in the case of bulk <strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b167652792132050">INSERT</strong> operations. If this feature is enabled, a scan will be performed on all tuple data within the page to generate a dictionary and then the tuple data will be compressed and stored. If <strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b191145031132050">NOCOMPRESS</strong> is used, tables will not be compressed.</p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p132633593417"><a href="dws_16_0016.html#EN-US_TOPIC_0000001772696060__en-us_topic_0000001706105077_en-us_topic_0000001434418777_li7638164673410">table.compress.row</a> and <a href="dws_16_0016.html#EN-US_TOPIC_0000001772696060__en-us_topic_0000001706105077_en-us_topic_0000001434418777_li06731353153514">table.compress.column</a> determine the compression level, which determines the compression ratio and duration. Generally, the higher the level of compression, the higher the ratio, the longer the duration, vice versa. The actual compression ratio depends on the distribution mode of table data loaded.</p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p263911451183"><a href="dws_16_0016.html#EN-US_TOPIC_0000001772696060__en-us_topic_0000001706105077_en-us_topic_0000001434418777_li8585858112211">table.compress.level</a> determines the compression sublevel, which determines the table data compression ratio and duration. A compression level is divided into sublevels, providing more choices for the compression ratio and duration. As the value becomes larger, the compression ratio becomes higher and duration longer at the same compression level.</p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p73691243103819"><strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b1836934311389">Input example of a row-store table</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_screen1636914315387">drop table if exists `public`.`runoob_tbl`;
CREATE TABLE IF NOT EXISTS `public`.`runoob_tbl`(
`runoob_id` VARCHAR,
`runoob_title` VARCHAR(100) NOT NULL,
`runoob_author` VARCHAR(40) NOT NULL,
`submission_date` VARCHAR
)ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p73701743123814"><strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b93701743163814">Output example of a row-store table</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_screen203709431384">DROP TABLE IF EXISTS "public"."runoob_tbl";
CREATE TABLE IF NOT EXISTS "public"."runoob_tbl" (
"runoob_id" VARCHAR,
"runoob_title" VARCHAR(400) NOT NULL,
"runoob_author" VARCHAR(160) NOT NULL,
"submission_date" VARCHAR
) WITH (ORIENTATION = ROW, COMPRESSION = YES) COMPRESS DISTRIBUTE BY HASH ("runoob_id");</pre>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p158416408382"></p>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p46401768376"><strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b1664013673712">Input example of a column-store table</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_screen364015611376">drop table if exists `public`.`runoob_tbl`;
CREATE TABLE IF NOT EXISTS `public`.`runoob_tbl`(
`runoob_id` VARCHAR,
`runoob_title` VARCHAR(100) NOT NULL,
`runoob_author` VARCHAR(40) NOT NULL,
`submission_date` VARCHAR
)ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
<p id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_p186401060379"><strong id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_b664012693717">Output example of a column-store table</strong></p>
<pre class="screen" id="EN-US_TOPIC_0000001819416249__en-us_topic_0000001658024654_en-us_topic_0000001448662801_screen96401763378">DROP TABLE IF EXISTS "public"."runoob_tbl";
CREATE TABLE IF NOT EXISTS "public"."runoob_tbl" (
"runoob_id" VARCHAR,
"runoob_title" VARCHAR(400) NOT NULL,
"runoob_author" VARCHAR(160) NOT NULL,
"submission_date" VARCHAR
) WITH (
COMPRESSLEVEL = 1,
ORIENTATION = COLUMN,
COMPRESSION = LOW
) DISTRIBUTE BY HASH ("runoob_id");</pre>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_16_0119.html">Table (Optional Parameters and Operations)</a></div>
</div>
</div>