Skip to content
Install

Monitor a database

The Observe tab of a database shows metrics and query statistics, so you can find slow queries and decide whether the database needs more resources before users notice.

Metrics and query statistics are available only for dedicated databases.

  1. Open the database.
  2. Go to Observe > Metrics.
  3. Select a time range.

The Metrics view has the following panels:

SectionPanels
ActivityConnections, Transactions, Cache hit
Replication & storageReplication lag, Database size, Disk used
ResourcesCPU, Memory, Network in, Network out
HealthDeadlocks. This panel appears only when the range contains a deadlock.

The Disk used panel marks 80% full and 92% full. Writes pause at 92%, so grow the storage before the line reaches that mark.

Query statistics use the pg_stat_statements extension. Turning on the extension restarts the database once.

  1. Open the database.
  2. Go to Observe > Queries.
  3. Select Enable.
  1. Open the database.
  2. Go to Observe > Queries.
  3. In Rank queries by, select one of these options:
    • Most time: Total time across all calls.
    • Most frequent: Number of calls.
    • Slowest: Mean time for each call.
  4. (Optional) In Filter queries, enter text to search for.
  5. Select a row to read the full query.

To clear the collected statistics, select Reset.

The Overview tab of a database includes a console. In the console, Logs shows Postgres logs and Killed shows the output of containers that were killed.

To read this data from the CLI, run the following commands:

orchard db logs <id>
orchard db killed list <id>

To print a summary of database health, run the following command:

orchard db diagnose <dbId>