Manual:category table

From MediaWiki.org
Jump to: navigation, search
Manual:Contents MediaWiki database layout category table



MediaWiki version: 1.13

Track all existing categories. Something is a category if

  1. it has an entry somewhere in categorylinks, or
  2. it once did.

Categories might not have corresponding pages, so they need to be tracked separately. cat_pages, cat_subcats, and cat_files are signed to make underflow more obvious.

Note Note: The pages and sub-categories are stored in the categorylinks table.

Note Note: Information regarding which categories are hidden is stored in the page_props table.

Note Note: The number fields are signed to make underflow more obvious. We make the first number include the second two for better sorting: subtracting for display is easy, adding for ordering is not.

Note Note: If the information in this table is incorrect, run the maintenance script populateCategory.php, if neccessary with the --force option.

Fields[edit | edit source]

cat_id[edit | edit source]

Primary key

cat_title[edit | edit source]

Name of the category, in the same form as page.page_title (with underscores). If there is a category page corresponding to this category, by definition, it has this name (in the Category namespace).

cat_pages[edit | edit source]

Number of pages in the category. This number includes the number of subcategories and the number of files.

cat_subcats[edit | edit source]

Number of sub-categories in the category.

cat_files[edit | edit source]

Number of files (i.e. Image: namespace members) in the category.

cat_hidden[edit | edit source]

MediaWiki version: 1.19

Was reserved for future use; apparently no one found a use for it because it was removed in v1.20. Instead, the status of hidden categories is stored in the page props table as the property "hiddencat" in pp_propname.

Schema[edit | edit source]

MediaWiki version: 1.20


mysql> describe category;
+-------------+------------------+------+-----+---------+----------------+
| Field       | Type             | Null | Key | Default | Extra          |
+-------------+------------------+------+-----+---------+----------------+
| cat_id      | int(10) unsigned | NO   | PRI | NULL    | auto_increment |
| cat_title   | varbinary(255)   | NO   | UNI | NULL    |                |
| cat_pages   | int(11)          | NO   | MUL | 0       |                |
| cat_subcats | int(11)          | NO   |     | 0       |                |
| cat_files   | int(11)          | NO   |     | 0       |                |
+-------------+------------------+------+-----+---------+----------------+
5 rows in set (0.00 sec)


MediaWiki version: 1.19


mysql> describe category;
+-------------+---------------------+------+-----+---------+----------------+
| Field       | Type                | Null | Key | Default | Extra          |
+-------------+---------------------+------+-----+---------+----------------+
| cat_id      | int(10) unsigned    | NO   | PRI | NULL    | auto_increment |
| cat_title   | varbinary(255)      | NO   | UNI | NULL    |                |
| cat_pages   | int(11)             | NO   | MUL | 0       |                |
| cat_subcats | int(11)             | NO   |     | 0       |                |
| cat_files   | int(11)             | NO   |     | 0       |                |
| cat_hidden  | tinyint(3) unsigned | NO   |     | 0       |                |
+-------------+---------------------+------+-----+---------+----------------+


MediaWiki version: 1.14
MediaWiki version: 1.13


 +-------------+---------------------+------+-----+---------+----------------+
 | Field       | Type                | Null | Key | Default | Extra          |
 +-------------+---------------------+------+-----+---------+----------------+
 | cat_id      | int(10) unsigned    |      | PRI | NULL    | auto_increment |
 | cat_title   | varbinary(255)      |      | UNI |         |                |
 | cat_pages   | int(11)             |      | MUL | 0       |                |
 | cat_subcats | int(11)             |      |     | 0       |                |
 | cat_files   | int(11)             |      |     | 0       |                |
 | cat_hidden  | tinyint(3) unsigned |      |     | 0       |                |
 +-------------+---------------------+------+-----+---------+----------------+
Databases Engines: MySQLOraclePostgreSQLSQLite
Technical documentation: Schema (tables) – API property associationsField prefixesPrimary key storage in other fieldsWikimedia extension tables
Configuration: SettingsSharing
Development: AccessOptimizationPolicyUpdaterExtension schema updatesPatch file
Core tables: archivecategorycategorylinkschange_tagconfigexternallinksfilearchivehitcounterimageimagelinksinterwikiiwlinksipblocksjobl10n_cachelanglinkslogginglog_searchmsg_resourcemsg_resource_linksmodule_depsobjectcacheoldimagepagepagelinkspage_propspage_restrictionsprotected_titlesquerycachequerycachetwoquerycache_inforecentchangesredirectrevisionsearchindexsitessite_statstag_summarytemplatelinkstexttranscacheupdateloguploadstashuseruser_former_groupsuser_groupsuser_newtalkuser_propertiesvalid_tagwatchlist
Language: English  • polski