Manual:hitcounter table

Jump to navigation Jump to search
Translate this page; This page contains changes which are not marked for translation.

Other languages:
English • ‎español • ‎日本語 • ‎português do Brasil
Manual:ContentsManual:Contents MediaWiki database layoutManual:Database layout hitcounter table

MediaWiki versions: 1.3 – 1.24

The hitcounter table in MediaWiki is a temporary buffer for storage of page view information. If $wgHitcounterUpdateFreqManual:$wgHitcounterUpdateFreq is set to a value bigger than 1, this table stores the page_idManual:page table#page_id value of every page that was visited. The value of $wgHitcounterUpdateFreq is then fed into a randomizer, which then updates the page_counterpage table#page_counter fields of the stored pages when the random number is equal to a particular value. This reduces database load; updating the page_counter field with every page hit is a main source for slow queries. After this batch update of the page_counter fields has been done, the hitcounter table is emptied.

This table was introduced in MediaWiki 1.3, and will always be empty if $wgDisableCountersManual:$wgDisableCounters is set to true. Additionally, if $wgHitcounterUpdateFreqManual:$wgHitcounterUpdateFreq is set to 1, the page table is directly updated, and this table is not used.

This table has been removed from the MediaWiki Core to an extension in MediaWiki 1.25 since the page counter feature itself has been removed from Core. See Requests for comment/Removing hit counters from MediaWiki core. This functionality was then provided by the HitCountersExtension:HitCounters extension. If the extension has been in use, data in this table has been moved to another place and the hitcounter table (if still present) has been removed in MediaWiki 1.26.



Contains the page_idPage table#page_id of each visited page in the buffer.

Schema summary[edit]

MediaWiki version: 1.3

DESCRIBE hitcounter;

| Field | Type             | Null | Key | Default | Extra |
| hc_id | int(10) unsigned | NO   |     | NULL    |       |
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: actorarchivebot_passwordscategorycategorylinkschange_tagcommentconfigexternallinksfilearchivehitcounterimageimagelinksimage_comment_tempinterwikiiwlinksipblocksip_changesjobl10n_cachelanglinkslogginglog_searchmsg_resourcemsg_resource_linksmodule_depsobjectcacheoldimagepagepagelinkspage_propspage_restrictionsprotected_titlesquerycachequerycachetwoquerycache_inforecentchangesredirectrevisionrevision_comment_tempsearchindexsitessite_identifierssite_statstag_summarytemplatelinkstexttranscacheupdateloguploadstashuseruser_former_groupsuser_groupsuser_newtalkuser_propertiestag_summaryvalid_tagwatchlist