{% from "leeuwenhoek/_macros.html" import entry_table with context %} {# One card per related section of the batch, with its count, slow entries, cache hits, total time and, for queries, the statements repeated enough to look like an N+1. #} {% for g in (groups if groups is defined else related) %}

{{ g.label }} {{ g.count }} {%- if g.slow %}{{ g.slow }} slow{% endif %} {%- if g.type == "cache" %}{{ g.hits }} hits{{ g.misses }} misses{% endif %} {%- if g.n_plus_one %}n+1{% endif %}

{% if g.total_ms %}

{{ g.total_ms | lw_duration }} in total

{% endif %}
{% if g.n_plus_one %}

Possible N+1 queries

    {% for sql, count in g.n_plus_one %}
  • {{ sql | lw_truncate(160) }} × {{ count }}
  • {% endfor %}
{% endif %} {{ entry_table(g.entries, g.type) }}
{% endfor %}