Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
Fork of
Commons file pages linked from a page - very slow with extra join
by
Jheald
This query is marked as a draft
This query has been published
by
Jheald
.
Joining the page table requires page-namespace as well as page-title to be specified, for join to be fast using multi-column index
Toggle Highlighting
SQL
use commonswiki_p; SELECT DISTINCT fp.page_title #, GROUP_CONCAT(cl.cl_to SEPARATOR ' / ') AS cats FROM page AS p0 JOIN pagelinks AS pl ON pl.pl_from=p0.page_id AND pl.pl_from_namespace=p0.page_namespace AND pl.pl_namespace=6 JOIN page AS fp ON fp.page_namespace = pl.pl_namespace AND fp.page_title = pl.pl_title # JOIN categorylinks AS cl ON cl.cl_from = fp.page_id WHERE p0.page_title='British_Library/MC_maps_batch_01_(GB_counties)' AND p0.page_namespace=4
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...