{# Advisor card — findings with the SQL to run, top queries, optional AI summary. #} {% from "components/feedback.html" import badge %}
Advisor {% if counts.error %}{{ badge(counts.error ~ " critical", "error") }}{% endif %} {% if counts.warning %}{{ badge(counts.warning ~ " warning" ~ ('' if counts.warning == 1 else 's'), "warning") }}{% endif %} {% if counts.info %}{{ badge(counts.info ~ " info", "info") }}{% endif %} {% if not findings %}{{ badge("nothing to fix", "success") }}{% endif %}
{% if top_queries %} {% endif %}
{% if error %}
{{ error }}
{% endif %} {% if findings %}
{% for f in findings %}
{{ f.title }} {% if f.impact %}{{ f.impact }}{% endif %}
{{ f.detail }}
{% if f.fix %}
{{ f.fix }}
{% endif %}
{% endfor %}
{% elif not error %}
No foreign keys without an index, no sequential-scan-heavy tables, no unused or duplicate indexes, no dead-tuple pile-ups, statistics up to date.{% if not stats_available %} Install pg_stat_statements to also get the slowest queries.{% endif %}
{% endif %} {% if top_queries %}
{% for q in top_queries %} {% endfor %}
QueryCallsTotalMeanSeq scans
{{ q.query[:140] }} {{ q.calls }} {{ q.total_time_ms }} ms {{ q.mean_time_ms }} ms {% for s in q.seq_scans %}{{ s.table }} {% endfor %}
{% elif not stats_available and findings %}
Install pg_stat_statements to also see the slowest queries and their plans here.
{% endif %}