Jump to content

手册:comment表

From mediawiki.org
This page is a translated version of the page Manual:Comment table and the translation is 46% complete.
手册:索引 MediaWiki数据库布局 comment table
MediaWiki版本:
1.30

The comment table stores edits, blocks, and other actions which typically have a textual comment describing the action. They are stored in a separate table to reduce the size of the main tables, and to allow for de-duplication.

De-duplication is currently best-effort to avoid locking on inserts that would be required for strict de-duplication. 可能有多行具有相同的comment_textcomment_data

此表是在 Gerrit change 357892 中添加的。

欄位

comment_id

辨識每個摘要的唯一ID。

comment_hash

comment_textcomment_data的雜湊值,用以去除重複值。 The current algorithm is a signed CRC32 of the comment text XOR'd with a CRC32 of any comment data.

comment_text

變更的文本摘要,例如編輯者的編輯摘要。 此文字顯示在歷史貢獻 It is also used for recent changes , related changes , watchlists , and, in the case of page creation, for the list of new pages . It is rendered in a sanitized subset of wiki markup by MediaWiki\CommentFormatter\CommentFormatter::format(). Size limits are enforced at the application level, and should take care to crop UTF-8 strings appropriately.

comment_data

JSON data, intended for localizing auto-generated comments. This holds structured data that is intended to be used to provide localized versions of automatically-generated comments. When not empty, comment_text should be the generated comment localized using the wiki's content language.

架構

MediaWiki版本:
1.30

DESCRIBE comment;

+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| comment_id   | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| comment_hash | int(11)             | NO   | MUL | NULL    |                |
| comment_text | blob                | NO   |     | NULL    |                |
| comment_data | blob                | YES  |     | NULL    |                |
+--------------+---------------------+------+-----+---------+----------------+

索引

MediaWiki版本:
1.30

SHOW INDEX IN comment;

+---------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table   | Non_unique | Key_name     | Seq_in_index | Column_name  | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+---------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| comment |          0 | PRIMARY      |            1 | comment_id   | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| comment |          1 | comment_hash |            1 | comment_hash | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+---------+------------+--------------+--------------+--------------+-----------+-------------+----------+--------+------+------------+---------+---------------+

代碼維護

See also