doc-exports/docs/dws/umn/dws_03_2143.html
Lu, Huayi 95132e24fc DWS UMN 830.201_new version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Reviewed-by: Rechenburg, Matthias <matthias.rechenburg@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-05-27 11:54:34 +00:00

22 lines
3.9 KiB
HTML

<a name="EN-US_TOPIC_0000001790141229"></a><a name="EN-US_TOPIC_0000001790141229"></a>
<h1 class="topictitle1">How Are Dirty Pages Generated in GaussDB(DWS)?</h1>
<div id="body0000001790141229"><div class="section" id="EN-US_TOPIC_0000001790141229__section7267151173619"><h4 class="sectiontitle">Causes</h4><p id="EN-US_TOPIC_0000001790141229__p18511635368">By using the versioning concurrency control (MVCC) mechanism, GaussDB(DWS) can achieve consistency and concurrency for multiple transactions that access the database simultaneously. This mechanism has the benefit of avoiding read-write conflicts, but the drawback of causing disk bloat and dirty pages.</p>
</div>
<p id="EN-US_TOPIC_0000001790141229__p173140182519">The scenarios are as follows:</p>
<ul id="EN-US_TOPIC_0000001790141229__ul66284226269"><li id="EN-US_TOPIC_0000001790141229__li5628822112613">When the DELETE operation is performed on a table, data is logically deleted but not physically deleted from the disk.</li><li id="EN-US_TOPIC_0000001790141229__li106288229262">When the UPDATE operation is performed on a table, GaussDB(DWS) logically marks the data to be updated as delete and inserts new data.</li></ul>
<p id="EN-US_TOPIC_0000001790141229__p15672048122713">For the DELETE and UPDATE operations in a table, the data marked as deleted is called discarded tuples. The proportion of discarded tuples in the entire table is the dirty page rate. Therefore, when the dirty page rate of a table is high, the proportion of data marked as deleted in the table is high.</p>
<div class="section" id="EN-US_TOPIC_0000001790141229__section1285912714361"><h4 class="sectiontitle">Solution:</h4><p id="EN-US_TOPIC_0000001790141229__p6920730193611">GaussDB(DWS) provides a system view for querying the dirty page rate. For details, see section "PGXC_STAT_TABLE_DIRTY" in <em id="EN-US_TOPIC_0000001790141229__i53791333192910">Data Warehouse Service (DWS) Development Guide</em> .</p>
</div>
<p id="EN-US_TOPIC_0000001790141229__p116991352153815">To solve the problem of disk space bloat caused by high dirty page rate, GaussDB(DWS) provides the VACUUM function to clear the data logically marked as deleted. For details, see "VACUUM" in <em id="EN-US_TOPIC_0000001790141229__i16622132822911">Data Warehouse Service (DWS) SQL Syntax Reference</em> .</p>
<p id="EN-US_TOPIC_0000001790141229__p13147162418235"><strong id="EN-US_TOPIC_0000001790141229__b2076425513112">VACUUM</strong> does not release the allocated space. To completely reclaim the cleared space, run <strong id="EN-US_TOPIC_0000001790141229__b81281928322">VACUUM FULL</strong>.</p>
<div class="note" id="EN-US_TOPIC_0000001790141229__note332955162111"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0000001790141229__ul3846141212220"><li id="EN-US_TOPIC_0000001790141229__li1384716121221"><strong id="EN-US_TOPIC_0000001790141229__b1229764911364">VACUUM FULL</strong> clears and releases the space of deleted data, improving database performance and efficiency. However, running <strong id="EN-US_TOPIC_0000001790141229__b5492619113717">VACUUM FULL</strong> consumes more time and resources, and may cause some tables to be locked. Therefore, run <strong id="EN-US_TOPIC_0000001790141229__b20147130113717">VACUUM FULL</strong> only when the database load is light.</li><li id="EN-US_TOPIC_0000001790141229__li984710124227">To reduce the impact of disk bloat on database performance, you are advised to do <strong id="EN-US_TOPIC_0000001790141229__b1215511378">VACUUM FULL</strong> on non-system catalogs whose dirty page rate exceeds 80%. You can determine whether to do <strong id="EN-US_TOPIC_0000001790141229__b8674101213810">VACUUM FULL</strong> based on service scenarios.</li></ul>
</div></div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_03_0001.html">General Problems</a></div>
</div>
</div>