Manual:category table

From MediaWiki.org
Jump to: navigation, search
Language:Project:Language policy English  • polski
Manual:ContentsManual:Contents MediaWiki database layoutManual: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 (task T28411).

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]

cat_id[edit]

Primary key

cat_title[edit]

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]

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

cat_subcats[edit]

Number of sub-categories in the category.

cat_files[edit]

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

cat_hidden[edit]

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 summary[edit]

MediaWiki version: 1.20

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       |                |
+-------------+---------------------+------+-----+---------+----------------+


MediaWiki versions: 1.13 – 1.19

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       |                |
 +-------------+---------------------+------+-----+---------+----------------+
DatabasesManual:Database layout Engines: MySQL/MariaDBManual:MySQLOracleManual:OraclePostgreSQLManual:PostgreSQLSQLiteManual:SQLiteSQL ServerManual:Microsoft SQL Server

Technical documentation: SchemaManual:Database layout (tablesCategory:MediaWiki database tables) – API property associationsAPI:Database field and API property associationsField prefixesDatabase field prefixesPrimary key storage in other fieldsManual:Primary key storage in other fieldsWikimedia extension tablesCategory:Wikimedia extension database tables
Configuration: SettingsManual:Configuration_settings#Database_settingsSharingManual:Shared database
Development: AccessManual:Database accessOptimizationDatabase optimizationPolicyDevelopment policy#Database_patchesUpdaterManual:DatabaseUpdater.phpExtension schema updatesManual:Hooks/LoadExtensionSchemaUpdatesPatch fileManual:SQL patch file

Core tables: archivebot_passwordscategorycategorylinkschange_tagconfigexternallinksfilearchivehitcounterimageimagelinksinterwikiiwlinksipblocksjobl10n_cachelanglinkslogginglog_searchmsg_resourcemsg_resource_linksmodule_depsobjectcacheoldimagepagepagelinkspage_propspage_restrictionsprotected_titlesquerycachequerycachetwoquerycache_inforecentchangesredirectrevisionsearchindexsitessite_identifiers - site_statstag_summarytemplatelinkstexttranscacheupdateloguploadstashuseruser_former_groupsuser_groupsuser_newtalkuser_propertiestag_summaryvalid_tagwatchlist