We want the page_timestamp index to be used in this case, but sometimes
the rev_timestamp is chosen which leads to bad performance.
Also update WikiPage::getOldestRevision() which uses the exact same query.
I'll implement one in terms of the other in a follow-up commit.
Bug: T159319
Change-Id: I7c5c0a9b1af99ce2b5f4bdcc99710d8400ca8bcf
$row = $db->selectRow( 'revision', Revision::selectFields(),
[ 'rev_page' => $pageId ],
__METHOD__,
- [ 'ORDER BY' => 'rev_timestamp ASC', 'LIMIT' => 1 ]
+ [
+ 'ORDER BY' => 'rev_timestamp ASC',
+ 'LIMIT' => 1,
+ 'IGNORE INDEX' => 'rev_timestamp'
+ ]
);
if ( $row ) {
return new Revision( $row );
],
__METHOD__,
[
- 'ORDER BY' => 'rev_timestamp ASC'
+ 'ORDER BY' => 'rev_timestamp ASC',
+ 'IGNORE INDEX' => 'rev_timestamp'
]
);