Last modified: 2007-12-16 21:14:51 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 10280 - For table categorylinks, add cl_from to the cl_sortkey index
For table categorylinks, add cl_from to the cl_sortkey index
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: schema-change
Depends on:
  Show dependency treegraph
Reported: 2007-06-15 18:18 UTC by Yuri Astrakhan
Modified: 2007-12-16 21:14 UTC (History)
3 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Yuri Astrakhan 2007-06-15 18:18:05 UTC
When API enumerates through the list of pages in a given category, it needs a way to resume the query. Sortkey provides a good point from which to continue, but has one drawback - more than one page may have identical one, which may lead to the following bug scenario:

Assuming there are 20 pages in a category, and page 10 and 11 both have identical sortkey, the user's query may request go 10 pages at a time. The sortkey to continue from would be the value of #11, but since it is the same as #10, #10 will be returned twice - in both the first and second resultset. This might even result in an infinite loop - requesting one item at a time would reach #10 and never advance to #11.

Solution:  sort by sortkey + cl_from, and store both the sortkey and cl_from as the starting point.

To optimize query execution, cl_sortkey needs to be modified by adding cl_from at the end:

ALTER TABLE `wikidb`.`categorylinks` DROP INDEX `cl_sortkey`,
 ADD INDEX `cl_sortkey` USING BTREE(`cl_to`, `cl_sortkey`, `cl_from`)
Comment 1 Yuri Astrakhan 2007-06-15 18:46:54 UTC
Checked in r23016 schema update. Pending servers update.
Comment 2 Yuri Astrakhan 2007-06-22 15:21:16 UTC
Another check-in r23228 - sql table scripts.
Comment 3 Jonathan 2007-09-15 01:13:19 UTC
This seems to contribute to the common bug (index key too long). See my comments there. I've "reopened" this bug but apologise if this was not the correct course of action. Best wishes.
Comment 4 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-12-16 21:14:51 UTC
Not relevant, that's a separate issue.  Re-resolving.

Note You need to log in before you can comment on or make changes to this bug.