{% load i18n %}

๐Ÿฉบ {% trans "Health" %}

{% trans "disk usage ยท unused / redundant / unindexed-FK ยท orphan rows ยท dead rows" %}

{% trans "Table sizes" %} heap + indexes + toast
{% if sizes %} {% for s in sizes %} {% endfor %}
{% trans "Table" %} {% trans "Total" %} {% trans "Table" %} {% trans "Indexes" %}
{{ s.qualified }}
{{ s.total }}
{{ s.table }} {{ s.index }}
{% elif sizes_error %}

{{ sizes_error }}

{% else %}

{% trans "No user tables." %}

{% endif %}
{% trans "Unused indexes" %} idx_scan = 0 since last stats reset
{% if unused %} {% for u in unused %} {% endfor %}
{% trans "Index" %} {% trans "On table" %} {% trans "Scans" %} {% trans "Size" %}
{{ u.name }} {{ u.schema }}.{{ u.table }} {{ u.scans }} {{ u.size|default:"โ€”" }}
{% else %}

{% trans "No unused indexes โ€” every index has been used. ๐ŸŽ‰" %}

{% endif %}
{% if supports_null_slip %}
{% trans "UNIQUE with a NULL hole" %} NULLs are distinct โ€” duplicates fit through
{% if null_slips %} {% for u in null_slips %} {% endfor %}
{% trans "Table" %} {% trans "Unique on" %} {% trans "Nullable" %} {% trans "Slipped through" %}
{{ u.qualified }} {{ u.columns }} ({{ u.constraint|default:u.index }}) {{ u.nullable }}
{% blocktrans %}A NULL is not equal to another NULL, so rows whose key holds one are all different to the index โ€” the constraint is enforced, with a hole the shape of its nullable columns. PostgreSQL 15's NULLS NOT DISTINCT closes it; those indexes are not listed. Counting reads the table, read-only.{% endblocktrans %}
{% else %}

{% trans "No composite UNIQUE has a nullable column โ€” no hole to fit through. ๐ŸŽ‰" %}

{% endif %}
{% endif %} {% if supports_invalid_index %}
{% trans "Invalid indexes" %} indisvalid = false โ€” the planner ignores these
{% if invalid %} {% for ix in invalid %} {% endfor %}
{% trans "Index" %} {% trans "On table" %} {% trans "State" %} {% trans "Size" %}
{{ ix.name }} {{ ix.schema }}.{{ ix.table }} {% if ix.building %} {% trans "building" %} {% elif not ix.live %} {% trans "drop failed" %} {% else %} {% trans "build failed" %} {% endif %} {{ ix.size|default:"โ€”" }}
{% else %}

{% trans "No invalid indexes โ€” every index is usable. ๐ŸŽ‰" %}

{% endif %}
{% endif %}
{% trans "Unindexed foreign keys" %} FK columns with no supporting index {% if supports_fk_index %} {% endif %}
{% if not supports_fk_index %}

{% trans "Not applicable to this engine โ€” InnoDB requires and auto-creates an index on every foreign key's columns, so there's never one missing." %}

{% elif fk_missing %} {% for f in fk_missing %} {% endfor %}
{% trans "Table" %} {% trans "Columns" %} {% trans "References" %} {% trans "Constraint" %}
{{ f.qualified }} {{ f.columns }} {{ f.references }} {{ f.constraint }}
{% blocktrans %}PostgreSQL doesn't auto-index the referencing side of a foreign key, so FK checks, cascade deletes and joins to the parent scan the whole table. A fact, not a rule โ€” index if these paths are hot.{% endblocktrans %}
{% else %}

{% trans "Every foreign key has a supporting index. ๐ŸŽ‰" %}

{% endif %}
{% trans "Redundant indexes" %} covered by another index on the same table
{% if duplicates %} {% for d in duplicates %} {% endfor %}
{% trans "Table" %} {% trans "Redundant index" %} {% trans "Covered by" %} {% trans "Size" %}
{{ d.qualified }} {{ d.name }} ({{ d.columns }}) {% if d.identical %}{% trans "identical" %}{% endif %} {{ d.covered_by }} ({{ d.covered_by_columns }}) {{ d.size|default:"โ€”" }}
{% blocktrans %}A non-unique index whose columns are a leading prefix of (or identical to) another โ€” the wider index already serves its lookups. Dropping the redundant one is your call.{% endblocktrans %}
{% else %}

{% trans "No redundant indexes โ€” no index is covered by another. ๐ŸŽ‰" %}

{% endif %}
{% trans "Unenforced references" %} NOT VALID FKs ยท *_id columns with no FK
{% if not supports_orphans %}

{% trans "Not applicable to this engine โ€” InnoDB has no NOT VALID clause, so a declared foreign key is always enforced and can't carry orphan rows." %}

{% elif orphan_candidates %} {% for o in orphan_candidates %} {% endfor %}
{% trans "Table" %} {% trans "Columns" %} {% trans "References" %} {% trans "Kind" %} {% trans "Orphan rows" %}
{{ o.qualified }} {{ o.columns }} {{ o.references }} ({{ o.ref_columns }}) {% if o.inferred %} {% trans "inferred" %} {% else %} {% trans "NOT VALID" %} {% endif %}
{% blocktrans %}A validated foreign key can't have orphans, so only unvalidated FKs and constraint-less *_id columns appear. Counting scans the table read-only โ€” it never validates or changes anything. A fact, not a rule.{% endblocktrans %}
{% else %}

{% trans "No unvalidated FKs, and every *_id column that names a table is backed by one. ๐ŸŽ‰" %}

{% endif %}
{% trans "Dead rows" %} n_dead_tup ยท last (auto)vacuum
{% if not supports_vacuum %}

{% trans "Not applicable to this engine โ€” InnoDB has no vacuum or dead-tuple model, so there's nothing to report here." %}

{% elif vacuum %} {% for v in vacuum %} {% endfor %}
{% trans "Table" %} {% trans "Live" %} {% trans "Dead" %} {% trans "Dead %" %} {% trans "Last vacuum" %} {% trans "Last analyze" %}
{{ v.qualified }} {{ v.live }} {{ v.dead }} {{ v.dead_pct }}% {% if v.last_vacuum %}{% blocktrans with t=v.last_vacuum|timesince %}{{ t }} ago{% endblocktrans %}{% else %}{% trans "never" %}{% endif %} {% if v.last_analyze %}{% blocktrans with t=v.last_analyze|timesince %}{{ t }} ago{% endblocktrans %}{% else %}{% trans "never" %}{% endif %}
{% else %}

{% trans "No table statistics yet." %}

{% endif %}
{% trans "Bloat estimate" %} pg_stats ยท approximate, no scan
{% if not supports_bloat %}

{% trans "Not applicable to this engine โ€” there's no MySQL/InnoDB equivalent of the pg_stats bloat estimate." %}

{% elif bloat %} {% for b in bloat %} {% endfor %}
{% trans "Table" %} {% trans "Size" %} {% trans "Wasted (est.)" %} {% trans "Wasted %" %} {% trans "Bloat ร—" %}
{{ b.qualified }} {{ b.table_bytes|filesizeformat }} {{ b.wasted_bytes|filesizeformat }} {{ b.wasted_pct }}% {{ b.bloat_ratio }}ร—
{% blocktrans %}An estimate from planner statistics โ€” run VACUUM FULL or pg_repack to reclaim. Needs a recent ANALYZE to be accurate.{% endblocktrans %}
{% elif bloat_error %}

{{ bloat_error }}

{% else %}

{% trans "No bloat to estimate (or stats not collected yet)." %}

{% endif %}