{% 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 ""), ] %} {% for label, value, extra in tiles %}
{{ value }}
{{ label }}
{% endfor %}
{% if profile.duplicate_count %}
{{ profile.duplicate_count }} statement(s) repeat SQL already run in this request. That is the signature of 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 %}