Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/164372
Change subject: Avoid the page join when not really needed
......................................................................
Avoid the page join when not really needed
* That sometimes triggered a filesorts when the title for the
inequality has certain (seemingly long) values.
Change-Id: I912df77ad43f025918e52d1494300d487a9deea1
---
M maintenance/findMissingFiles.php
1 file changed, 8 insertions(+), 6 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/72/164372/1
diff --git a/maintenance/findMissingFiles.php b/maintenance/findMissingFiles.php
index add7108..5818ee2 100644
--- a/maintenance/findMissingFiles.php
+++ b/maintenance/findMissingFiles.php
@@ -26,7 +26,7 @@
parent::__construct();
$this->mDescription = 'Find registered files with no
corresponding file.';
- $this->addOption( 'start', 'Starting file name', false, true );
+ $this->addOption( 'start', 'Start after this file name', false,
true );
$this->addOption( 'mtimeafter', 'Only include files changed
since this time', false, true );
$this->addOption( 'mtimebefore', 'Only includes files changed
before this time', false, true );
$this->setBatchSize( 300 );
@@ -42,9 +42,12 @@
$mtime1 = $dbr->timestampOrNull( $this->getOption(
'mtimeafter', null ) );
$mtime2 = $dbr->timestampOrNull( $this->getOption(
'mtimebefore', null ) );
- $joinTables = array( 'image' );
- $joinConds = array( 'image' => array( 'INNER JOIN', 'img_name =
page_title' ) );
+ $joinTables = array();
+ $joinConds = array();
if ( $mtime1 || $mtime2 ) {
+ $joinTables[] = 'page';
+ $joinConds['page'] = array( 'INNER JOIN',
+ array( 'page_title = img_name',
'page_namespace' => NS_FILE ) );
$joinTables[] = 'logging';
$on = array( 'log_page = page_id', 'log_type' => array(
'upload', 'move', 'delete' ) );
if ( $mtime1 ) {
@@ -58,10 +61,9 @@
do {
$res = $dbr->select(
- array_merge( array( 'page' ), $joinTables ),
+ array_merge( array( 'image' ), $joinTables ),
array( 'name' => 'img_name' ),
- array( 'page_namespace' => NS_FILE,
- "page_title >= " . $dbr->addQuotes(
$lastName ) ),
+ array( "img_name > " . $dbr->addQuotes(
$lastName ) ),
__METHOD__,
// DISTINCT causes a pointless filesort
array( 'ORDER BY' => 'name', 'GROUP BY' =>
'name',
--
To view, visit https://gerrit.wikimedia.org/r/164372
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I912df77ad43f025918e52d1494300d487a9deea1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits