Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/178724

Change subject: Log to DBPerformance when queries affect many rows
......................................................................

Log to DBPerformance when queries affect many rows

Change-Id: If82b596187b638888760f800bba2fea20fc7ae8a
---
M includes/db/Database.php
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/24/178724/1

diff --git a/includes/db/Database.php b/includes/db/Database.php
index eb9d9b3..f5e2b37 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -1196,6 +1196,12 @@
 
                if ( false === $ret ) {
                        $this->reportQueryError( $this->lastError(), 
$this->lastErrno(), $sql, $fname, $tempIgnore );
+               } else {
+                       $n = $this->affectedRows();
+                       if ( $n > 300 && PHP_SAPI !== 'cli' ) {
+                               wfDebugLog( 'DBPerformance',
+                                       "Query affected $n rows:\n$sql\n" . 
wfBacktrace( true ) );
+                       }
                }
 
                return $this->resultObject( $ret );

-- 
To view, visit https://gerrit.wikimedia.org/r/178724
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If82b596187b638888760f800bba2fea20fc7ae8a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to