> ## Documentation Index
> Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Database Health

> Monitor trigger coverage, RLS policy coverage, and index usage statistics for the platform database at /settings/system-health/database.

The Database Health page (`/settings/system-health/database`) provides a real-time view of database integrity indicators, including trigger coverage, row-level security policy coverage, and index usage — broken down by module.

## Overview

The page is gated by `platform.system_health.manage` at the route level. It calls `useDatabaseHealth` to load a `metrics` object containing a `summary`, an `issues` array, and a `byModule` breakdown. The header shows the last update timestamp (`metrics.generatedAt`) and provides **Refresh** and **Export JSON** buttons. The main grid shows `DatabaseHealthOverviewCard` (summary statistics) and `DbHealthIssuesList` (surfaced issues). A `ModuleCoverageTable` below lists per-module coverage statistics. Clicking the back arrow navigates to `/settings/system-health`.

## Who it's for

Requires permission `platform.system_health.manage`.

## Before you start

* You must hold `platform.system_health.manage`.
* Navigate from `/settings/system-health` using the Database Health card, or go directly to this URL.

## Steps

<Steps>
  <Step title="Open Database Health">
    Navigate to `/settings/system-health/database`. Metrics load automatically on page entry.
  </Step>

  <Step title="Review the overview summary">
    The left column card shows aggregate health statistics across trigger coverage, RLS policy coverage, and index usage.
  </Step>

  <Step title="Review issues">
    The right column panel lists specific issues detected in the database. Review each issue and act on it according to your platform runbook.
  </Step>

  <Step title="Review per-module coverage">
    The `ModuleCoverageTable` below shows coverage breakdowns by module, helping identify which modules have gaps.
  </Step>

  <Step title="Refresh metrics">
    Click the refresh icon to re-fetch current metrics from the database health hook.
  </Step>

  <Step title="Export metrics as JSON">
    Click the download icon to export the full metrics object as a timestamped JSON file for offline analysis or incident reporting.
  </Step>
</Steps>

## Key concepts

<AccordionGroup>
  <Accordion title="Trigger coverage">
    Trigger coverage measures whether the expected database triggers (e.g., for audit logging or updated\_at management) are present on each table.
  </Accordion>

  <Accordion title="RLS policy coverage">
    Row-level security coverage indicates whether RLS policies are enabled and present for each table that should have them.
  </Accordion>

  <Accordion title="Index usage">
    Index usage statistics help identify tables with missing or underused indexes that may affect query performance.
  </Accordion>
</AccordionGroup>

## Related

<Columns cols={2}>
  <Card title="Platform Foundation" icon="layer-group" href="/pf/overview">
    Platform Foundation overview.
  </Card>

  <Card title="Governance & parity" icon="scale-balanced" href="/governance/index">
    Documentation coverage and governance.
  </Card>
</Columns>

<Note>
  This page documents shipped product behavior. It is not medical, legal, or
  billing advice. Verify against your organization's policies and applicable
  regulations before using it for clinical, compliance, or billing decisions.
  Protected health information (PHI) shown in the product is governed by your
  tenant's access controls and is never exposed in this documentation.
</Note>

<Accordion title="Documentation sources">
  * src/routes/platform.tsx
  * src/platform/health/pages/DatabaseHealthPage.tsx
  * src/platform/health/hooks/useDatabaseHealth.ts
</Accordion>
