r71176 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71175‎ | r71176 | r71177 >
Date:22:29, 16 August 2010
Author:simetrical
Status:ok (Comments)
Tags:
Comment:
Add query count to $wgDebugDumpSql output

This makes it easy to see how many queries are being run on each view.
Also rephrased the message a bit.
Modified paths:
  • /trunk/phase3/includes/db/Database.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/db/Database.php
@@ -493,12 +493,14 @@
494494 }
495495
496496 if ( $this->debug() ) {
 497+ static $cnt = 0;
 498+ $cnt++;
497499 $sqlx = substr( $commentedSql, 0, 500 );
498500 $sqlx = strtr( $sqlx, "\t\n", ' ' );
499501 if ( $isMaster ) {
500 - wfDebug( "SQL-master: $sqlx\n" );
 502+ wfDebug( "Query $cnt (master): $sqlx\n" );
501503 } else {
502 - wfDebug( "SQL: $sqlx\n" );
 504+ wfDebug( "Query $cnt (slave): $sqlx\n" );
503505 }
504506 }
505507

Comments

#Comment by Catrope (talk | contribs)   11:23, 27 September 2010

This is very useful for frequent readers of the SQL debug log, thanks!

Status & tagging log