Manual:ip_changes table

From Linux Web Expert


Manual:Contents <translate> MediaWiki database layout</translate> <translate> <tvar name=1>ip_changes</tvar> table</translate>
<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.30
<translate> MediaWiki version:</translate>

Every time an edit by a logged out user is saved, a row is created in the ip_changes table. This stores the IP as a hex representation so that we can more easily find edits within an IP range. One of the primary purposes of the table is to support IP range queries at Special:Contributions. This table was introduced in Gerrit change 370946.

Fields

ipc_rev_id

Foreign key to the revision table, also serves as the unique primary key.

ipc_rev_timestamp

The timestamp of the revision.

ipc_hex

Hex representation of the IP address, as returned by IP::toHex().

  • For IPv4 it will resemble: ABCD1234
  • For IPv6: v6-ABCD1234000000000000000000000000

BETWEEN is then used to identify revisions within a given range.

Schema summary

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.36
<translate> MediaWiki version:</translate>

DESCRIBE ip_changes;

+-------------------+------------------+------+-----+---------+-------+
| Field             | Type             | Null | Key | Default | Extra |
+-------------------+------------------+------+-----+---------+-------+
| ipc_rev_id        | int(10) unsigned | NO   | PRI | 0       |       |
| ipc_rev_timestamp | binary(14)       | NO   | MUL | NULL    |       |
| ipc_hex           | varbinary(35)    | NO   | MUL |         |       |
+-------------------+------------------+------+-----+---------+-------+
<td class="mw-version-versionbox" title="<translate nowrap> MediaWiki <tvar name=1>1.35</tvar> is unsupported version</translate>">
1.30 – 1.35
<translate> MediaWiki versions:</translate>

DESCRIBE ip_changes;

+-------------------+------------------+------+-----+----------------+-------+
| Field             | Type             | Null | Key | Default        | Extra |
+-------------------+------------------+------+-----+----------------+-------+
| ipc_rev_id        | int(10) unsigned | NO   | PRI | 0              |       |
| ipc_rev_timestamp | binary(14)       | NO   | MUL |                |       |
| ipc_hex           | varbinary(35)    | NO   | MUL |                |       |
+-------------------+------------------+------+-----+----------------+-------+

Indexes

<td class="mw-version-versionbox" title="<translate nowrap> The latest stable version is <tvar name=1>1.41</tvar></translate>">
<translate> ≥</translate> 1.30
<translate> MediaWiki version:</translate>

SHOW INDEX IN ip_changes;

+------------+------------+-------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table      | Non_unique | Key_name          | Seq_in_index | Column_name       | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+------------+------------+-------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| ip_changes |          0 | PRIMARY           |            1 | ipc_rev_id        | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| ip_changes |          1 | ipc_rev_timestamp |            1 | ipc_rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| ip_changes |          1 | ipc_hex_time      |            1 | ipc_hex           | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
| ip_changes |          1 | ipc_hex_time      |            2 | ipc_rev_timestamp | A         |           0 |     NULL | NULL   |      | BTREE      |         |               |
+------------+------------+-------------------+--------------+-------------------+-----------+-------------+----------+--------+------+------------+---------+---------------+