{% extends "sqladmin/layout.html" %} {% block content %}
← All requests

{{ profile.method }} {{ profile.full_path }}

{% if profile.group and profile.group != profile.path %}
Route {{ profile.group }}
{% endif %}
{% set tiles = [ ("Status", profile.status_code, ""), ("Total", "%.1f ms"|format(profile.duration_ms), ""), ("In SQL", "%.1f ms"|format(profile.query_ms), ""), ("In Python", "%.1f ms"|format(profile.python_ms), ""), ("Queries", profile.query_count, ""), ("Duplicates", profile.duplicate_count, "border-orange" if profile.duplicate_count else ""), ("Blocking", profile.blocking_count, "border-red" if profile.blocking_count else ""), ] %} {% for label, value, extra in tiles %}
{{ value }}
{{ label }}
{% endfor %}
{% if profile.problems %}

Findings

most expensive first
{% for problem in profile.problems %}
{{ problem_labels.get(problem.type, problem.type) }} {{ problem.title }} {{ "%.1f"|format(problem.time_ms) }} ms
{{ problem.detail }}
{% if problem.evidence.get('frame') %}
Issued from
{{ problem.evidence['frame'] }}
{% endif %} {% if problem.evidence.get('source_sql') %}
Preceded by
{{ problem.evidence['source_sql'] }}
{% endif %} {% if problem.evidence.get('sql') %}
Statement
{{ problem.evidence['sql'] }}
{% endif %}
{% endfor %}
{% elif profile.duplicate_count %}
{{ profile.duplicate_count }} statement(s) repeat SQL already run in this request, but not enough of them, or for long enough, to be reported as an N+1. The stack on the repeated statement below names the line that issued it.
{% endif %}

Queries

{{ groups|length }} distinct statement{{ '' if groups|length == 1 else 's' }}, {{ profile.query_count }} execution{{ '' if profile.query_count == 1 else 's' }}
{% for g in groups %}
{{ g.operation }} {% if g.is_duplicate %} ×{{ g.count }} {% endif %} {% if g.failed %}failed{% endif %} {{ "%.2f"|format(g.total_ms) }} ms total {%- if g.count > 1 %} · {{ "%.2f"|format(g.total_ms / g.count) }} ms avg{% endif %}
{{ g.sql }}
{# `error` is the message; `first_failure` is the Query that carried it. #} {% if g.error %}
{{ g.error }}
{% endif %} {% if g.stack %}
Stack ({{ g.stack|length }} frames) {%- if g.failed %} — the failing call {%- elif g.is_duplicate %} — where the first of {{ g.count }} was issued{% endif %}
{% for frame in g.stack %}{{ frame }}
{% endfor %}
{% endif %} {# `call_sites` counts *distinct* stacks, not frames: more than one means the same SQL is issued from several places, so the stack above only explains some of the executions. #} {% if g.call_sites > 1 %}
Issued from {{ g.call_sites }} different call sites — the stack above is only the first.
{% endif %}
{% else %}
This request ran no SQL.
{% endfor %}
{% endblock %}