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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12280, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10280 - For table categorylinks, add cl_from to the cl_sortkey index
For table categorylinks, add cl_from to the cl_sortkey index
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
: schema-change
Depends on:
Blocks:
  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: ---


Attachments

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`)
, ENGINE = MyISAM;
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 http://bugzilla.wikimedia.org/show_bug.cgi?id=4445 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.


Navigation
Links