Last modified: 2012-11-11 11:26: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 T29081, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 27081 - Forcing an index on a select query when doing a table join gives a query error
Forcing an index on a select query when doing a table join gives a query error
Status: NEW
Product: MediaWiki
Classification: Unclassified
Database (Other open bugs)
unspecified
All All
: Normal minor (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-31 23:56 UTC by Sam Reed (reedy)
Modified: 2012-11-11 11:26 UTC (History)
1 user (show)

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


Attachments

Description Sam Reed (reedy) 2011-01-31 23:56:34 UTC
Forcing an index on a select query when doing a table join gives a query error, we get

SELECT page_title,page_namespace FROM `mw_page` JOIN `mw_categorylinks` ON ((page_id=cl_from)) FORCE INDEX (page_random) WHERE page_is_redirect = '0' AND (page_random >= 0.757003172866) AND cl_to = 'Test' ORDER BY page_random LIMIT 1

from within function "RandomPage::selectRandomPageFromDB". Database returned error "1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FORCE INDEX (page_random) WHERE page_is_redirect = '0' AND (page_random >= 0.757' at line 1 (localhost)".

When we want

SELECT page_title,page_namespace FROM `mw_page` FORCE INDEX (page_random) JOIN `mw_categorylinks` ON ((page_id=cl_from))  WHERE page_is_redirect = '0' AND (page_random >= 0.757003172866) AND cl_to = 'Test' ORDER BY page_random LIMIT 1


Noticed when refactoring RandomPage and RandomInCategory to reduce code duplication
Comment 1 db [inactive,noenotif] 2012-11-11 11:26:51 UTC
Sounds like bug 22613

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


Navigation
Links