This is the summary of the bug reported here: https://phabricator.wikimedia.org/T113901
This is the exact CREATE syntax of revision and page:
Tables have approximately the numbers or rows you see on the autoinc.
Forcing the other plan:
The actual query parsed has no issue:
Even ignoring the indexes does not work (it is not related to covering index):
I think this is a bug on the optimizer.
Running ANALYZE on both tables, even with use-stat-tables=PREFERABLY does not help (and it shouldn't, row counts are ok, it is that for some reason maria refuses to use the clearly better plan -that itself understands).
This could be a specific configuration we have, you can see most of it at:
Linux with MariaDB-like packages