User:RichMorin/mw site stats

From Meta, a Wikimedia project coordination wiki

Contains a single row with some aggregate info on the state of the site.


Inter-table Relationships[edit]

NA


MySQL Table Description[edit]

mysql> desc mw_site_stats;
+------------------+---------------------+------+-----+---------+-------+
| Field            | Type                | Null | Key | Default | Extra |
+------------------+---------------------+------+-----+---------+-------+
| ss_row_id        | int(8) unsigned     |      | PRI | 0       |       |
| ss_total_views   | bigint(20) unsigned | YES  |     | 0       |       |
| ss_total_edits   | bigint(20) unsigned | YES  |     | 0       |       |
| ss_good_articles | bigint(20) unsigned | YES  |     | 0       |       |
| ss_total_pages   | bigint(20)          | YES  |     | -1      |       |
| ss_users         | bigint(20)          | YES  |     | -1      |       |
| ss_admins        | int(10)             | YES  |     | -1      |       |
| ss_images        | int(10)             | YES  |     | -1      |       |
+------------------+---------------------+------+-----+---------+-------+
8 rows in set


Annotated Table Creation Code[edit]

-- Contains a single row with some aggregate info
-- on the state of the site.

CREATE TABLE /*$wgDBprefix*/site_stats (

  -- The single row should contain 1 here.

  ss_row_id           int(8)         unsigned     NOT NULL,
  
  -- Total number of page views, if hit counters are enabled.

  ss_total_views      bigint(20)     unsigned               default '0',
  
  -- Total number of edits performed.

  ss_total_edits      bigint(20)     unsigned               default '0',
  
  -- An approximate count of pages matching the following criteria:
  --
  --   * in namespace 0
  --   * not a redirect
  --   * contains the text '[['
  --
  -- See isCountable() in includes/Article.php

  ss_good_articles    bigint(20)     unsigned               default '0',
  
  -- Total pages, theoretically equal to
  --   SELECT COUNT(*) FROM page;
  -- except faster.

  ss_total_pages      bigint(20)                            default '-1',

  -- Number of users, theoretically equal to
  --   SELECT COUNT(*) FROM user;
  -- except faster.

  ss_users            bigint(20)                            default '-1',

  -- Deprecated; no longer updated as of 1.5

  ss_admins           int(10)                               default '-1',

  -- Number of images, equivalent to
  --  SELECT COUNT(*) FROM image;
  
  ss_images           int(10)                               default '0',

UNIQUE KEY            ss_row_id (ss_row_id)

) ENGINE=InnoDB;