diff options
| author | Rob Hudson | 2008-10-06 13:53:14 -0700 | 
|---|---|---|
| committer | Rob Hudson | 2008-10-06 13:53:46 -0700 | 
| commit | a3492e14765e3f898efc26913a8e8c4445a837b4 (patch) | |
| tree | d171c7310fec4c71b39f38cfbbcd463401d2f9f2 /debug_toolbar/templates | |
| parent | e9271bf69ab50cb24e38ac2205847c8d32b83ca8 (diff) | |
| download | django-debug-toolbar-a3492e14765e3f898efc26913a8e8c4445a837b4.tar.bz2 | |
Adding query profiling for MySQL.  Thanks to Simon Willison for the suggestion.
There's a big TODO on this one, which is to not display or attempt to execute
the profiling SQL calls if this isn't MySQL and if MySQL isn't >= version
5.0.37.  For now it's a nice playground of the profiler if you have MySQL
v5.0.37 or higher.
Diffstat (limited to 'debug_toolbar/templates')
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/sql.html | 1 | ||||
| -rw-r--r-- | debug_toolbar/templates/debug_toolbar/panels/sql_profile.html | 26 | 
2 files changed, 27 insertions, 0 deletions
diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql.html b/debug_toolbar/templates/debug_toolbar/panels/sql.html index 2abb68f..d35d83e 100644 --- a/debug_toolbar/templates/debug_toolbar/panels/sql.html +++ b/debug_toolbar/templates/debug_toolbar/panels/sql.html @@ -15,6 +15,7 @@  				{% if query.params %}  					<a class="remoteCall" href="/__debug__/sql_select/?sql={{ query.raw_sql|urlencode }}¶ms={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}&hash={{ query.hash }}">SELECT</a>  					<a class="remoteCall" href="/__debug__/sql_explain/?sql={{ query.raw_sql|urlencode }}¶ms={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}&hash={{ query.hash }}">EXPLAIN</a> +					<a class="remoteCall" href="/__debug__/sql_profile/?sql={{ query.raw_sql|urlencode }}¶ms={{ query.params|urlencode }}&time={{ query.time|floatformat:"4"|urlencode }}&hash={{ query.hash }}">PROFILE</a>  				{% endif %}  				</td>  				<td class="syntax">{{ query.sql|safe }}</td> diff --git a/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html b/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html new file mode 100644 index 0000000..c1d04ce --- /dev/null +++ b/debug_toolbar/templates/debug_toolbar/panels/sql_profile.html @@ -0,0 +1,26 @@ +<a class="back" href="">« Back</a> +<h3>SQL Profiled</h3> +<dl> +	<dt>Executed SQL</dt> +	<dd><pre>{{ sql|safe }}</pre></dd> +	<dt>Time</dt> +	<dd>{{ time }} ms</dd> +</dl> +<table> +	<thead> +		<tr> +			{% for h in headers %} +				<th>{{ h|upper }}</th> +			{% endfor %} +		</tr> +	</thead> +	<tbody> +		{% for row in result %} +			<tr class="{% cycle 'odd' 'even' %}"> +				{% for column in row %} +					<td>{{ column|escape }}</td> +				{% endfor %} +			</tr> +		{% endfor %} +	</tbody> +</table>  | 
