doc-exports/docs/das/umn/das_04_0069.html
Wang , Deng Ke 0f41701050 DAS UMN Initial version
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Wang , Deng Ke <wangdengke2@huawei.com>
Co-committed-by: Wang , Deng Ke <wangdengke2@huawei.com>
2022-10-18 12:51:00 +00:00

23 lines
4.2 KiB
HTML

<a name="das_04_0069"></a><a name="das_04_0069"></a>
<h1 class="topictitle1">Maintaining a Table</h1>
<div id="body1548669049392"><div class="section" id="das_04_0069__section60461353162212"><h4 class="sectiontitle">Scenarios</h4><p id="das_04_0069__p4287447473">While working with MySQL databases, you do a lot of changes such as data insert, update, and deletion, which may cause table fragmentation. As a result, the database server performance is deteriorated. To handle this, periodic maintenance is required.</p>
</div>
<div class="section" id="das_04_0069__section680705916178"><h4 class="sectiontitle">Functions</h4><ul id="das_04_0069__ul3273108171112"><li id="das_04_0069__li627313813113">Check<p id="das_04_0069__p1914532581817"><a name="das_04_0069__li627313813113"></a><a name="li627313813113"></a>The CHECK TABLE statement adds a read-only lock to the table.</p>
<p id="das_04_0069__p15433123741815">Allows you to check whether there are errors in database tables using the CHECK TABLE statement. You can check a table with any of the following methods:</p>
<ul id="das_04_0069__ul124331837181811"><li id="das_04_0069__li184331437111812"><strong id="das_04_0069__b173291629195019">Check</strong>: Scan rows to verify that deleted links are valid. Alternatively, calculate a key checksum for the rows and verifies the validity using the obtained checksum.</li><li id="das_04_0069__li6433103771810"><strong id="das_04_0069__b184531239121510">Fast</strong>: Check only tables that have not been closed properly.</li><li id="das_04_0069__li18433937111815"><strong id="das_04_0069__b124201836105012">Quick</strong>: Do not scan rows or check for incorrect links.</li><li id="das_04_0069__li74338379188"><strong id="das_04_0069__b102231447181510">Changed</strong>: Check only tables that have been changed since the last check or tables that have not been closed properly.</li><li id="das_04_0069__li243318371181"><strong id="das_04_0069__b474283851618">Extended</strong>: Search for keywords in each row. This ensures that the table is 100% consistent, but takes a long time.</li></ul>
</li><li id="das_04_0069__li1327328131115">Repair<p id="das_04_0069__p13273983112"><a name="das_04_0069__li1327328131115"></a><a name="li1327328131115"></a>Allows you to use the REPAIR TABLE statement to repair possibly corrupted or incorrect tables. You can repair tables using any of the following three methods:</p>
<ul id="das_04_0069__ul145257111191"><li id="das_04_0069__li5561557189"><strong id="das_04_0069__b164899185119">Check</strong>: a simple repair, which repairs data and index files.</li><li id="das_04_0069__li05713553188"><strong id="das_04_0069__b371181819512">Quick</strong>: the quickest repair, which repairs only index files, but not data files.</li><li id="das_04_0069__li6571552180"><strong id="das_04_0069__b108632025117">Extended</strong>: the slowest repair, which creates indexes row by row to repair data and index files.</li></ul>
</li></ul>
</div>
<div class="section" id="das_04_0069__section147601232144912"><h4 class="sectiontitle">Procedure</h4><p id="das_04_0069__p11624247144917">The following uses the <strong id="das_04_0069__b460811912270">Check</strong> operation as an example to explain how to maintain tables.</p>
<ol id="das_04_0069__ol188842054115319"><li id="das_04_0069__li58851754125313"><span>On the top menu bar, choose <strong id="das_04_0069__b1061818395259">Database Management</strong>.</span></li><li id="das_04_0069__li05421250349"><span>On the displayed <strong id="das_04_0069__b1150105510278">Objects</strong> page, select <span class="uicontrol" id="das_04_0069__uicontrol13150655162717"><b>Tables</b></span>, locate the target table, and choose <strong id="das_04_0069__b61511955122718">More</strong> &gt; <strong id="das_04_0069__b191511255132715">Maintain</strong> &gt; <strong id="das_04_0069__b1615165515275">Check</strong> in the <strong id="das_04_0069__b1615195522711">Operation</strong> column.</span></li><li id="das_04_0069__li10299183015541"><span>In the displayed dialog box, click <span class="uicontrol" id="das_04_0069__uicontrol20125162411411"><b>Yes</b></span>.</span></li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="das_04_0008.html">Table Management</a></div>
</div>
</div>