Avoid creating lots and lots of cat_id gaps
authorKevin Israel <pleasestand@live.com>
Fri, 28 Aug 2015 07:57:01 +0000 (03:57 -0400)
committerKevin Israel <pleasestand@live.com>
Sat, 17 Oct 2015 03:31:08 +0000 (23:31 -0400)
commitaebdfef5fefad48c56a2583f8a2f8e86ee90124e
treede0f17914047e4d704fbecdec1c7eb02a712b783
parent456b1463672e2cc516b444ff48268f79bf41df6e
Avoid creating lots and lots of cat_id gaps

Currently, INSERT...ON DUPLICATE KEY UPDATE is used to update the page
counts in the category table. However, MySQL 5.1.22 and newer, by default,
increment the counter for cat_id before checking for duplicate key errors.
This creates many gaps in the cat_id sequence.

To avoid this, check for existing category rows, and instead UPDATE any
that were found. It is hoped that the extra queries will not significantly
harm performance.

Change-Id: Ic2ab9ff14f04a0c7ea90a5b6756cade0c78e2885
includes/Category.php
includes/page/WikiPage.php