# Database monitoring

> Read the Database page (queries, repeated queries, reads and writes, tables) and connect a Supabase or Postgres database to see inside it.

Section: Each part of Relia · Page: https://tryrelia.com/docs/database · Last checked against the product: 2026-11-01
Video walkthrough: https://youtu.be/zpZNjfd7mVk

The **Database** page lists every query your services run, grouped by shape with the values removed, so `SELECT * FROM orders WHERE id = 42` and `... id = 43` are one row. It works with Postgres, MySQL, MongoDB, Redis and the other databases the Relia SDKs trace, and with Supabase calls made from the browser.

Open **Database** in the sidebar, under **Your product**.

## What the page shows

- **Time range**: 1 hour, 6 hours, 24 hours, 7 days or 30 days.
- **One card per database** your services use (for example Postgres and Redis).
- **Four numbers**: how many different queries, how many calls, how many failed, and the slowest one. Zero failed calls is what you hope to see.
- **Repeated queries (N+1)**: appears when one request runs the same query 10 or more times. It names the endpoint, how many times per request, how much of the request's time it takes, and links example requests. A typical case: a product list that loads each product's images one by one.
- **What your services do with the database**: calls split into **Reads**, **Inserts**, **Updates** and **Deletes**, with failures and the slowest p95.
- **Tables**: each table or collection, most time first, with reads, writes and failures.
- **Every query**: how often it runs, how long it takes (p50, p95, p99) and total time. Click a row for its trend and example slow or failed requests.

Statement values are masked by the SDK before anything leaves your server. Relia stores the shape of a query, not your data.

> **Tip:** watch [Find slow database queries and N+1 problems in production](https://youtu.be/igeM6t6GH6U) (2 min).

## See inside a Supabase or Postgres database

The page above shows queries as your app sees them. Connecting the database itself adds what Postgres measures: connections, database size, the most expensive queries, and scheduled jobs (pg_cron) that fail or stop running. This is available on every plan.

### Before you start

- You are an owner or admin of the Relia project.
- You can run SQL in your database (in Supabase: the **SQL editor**).

### Steps

1. On the **Database** page, find **See inside your Supabase / Postgres database** and click **Connect**. If Relia hasn't seen Postgres calls from your app yet, click the line **Using Supabase or Postgres? See inside your database** first.
2. Copy the SQL snippet Relia shows and run it once in your database. It creates a login called `relia_monitor` with a password made for you. No pg_cron? Skip the last two lines.
3. Copy the connection string. In Supabase: **Connect → Session pooler**, with the user `relia_monitor` and the password from the snippet. If your database has network restrictions, allow Relia's server first.
4. Paste it into Relia and click **Connect**.

### What Relia's login can do

The `relia_monitor` login reads statistics only. Relia refuses a login that can read your tables, create roles or bypass row-level security, and every connection is read-only. The connection string is stored encrypted.

### Check it worked

The page shows **Connections**, **Database size**, **Most expensive queries** and **Scheduled jobs (pg_cron)**. Relia reads them every 5 minutes; the first query numbers appear after two reads (about 10 minutes).

With the database connected, Relia also raises incidents when a scheduled job fails or stops running, connections reach 80 % of the limit, or a query gets much slower than its usual day.

## If something's wrong

- **The page is empty**: database calls are only recorded inside a request or a job. Check that your server SDK is sending requests first ([No data?](https://tryrelia.com/docs/no-data.md)).
- **Connect is refused**: the login has more rights than statistics. Use the `relia_monitor` login from the snippet, not your admin user.
- **No cron jobs listed**: pg_cron isn't installed, or the snippet's last two lines were skipped.

## Next

- [Slow database queries](https://tryrelia.com/docs/slow-database-queries.md)
- [Why is my API slow?](https://tryrelia.com/docs/slow-api.md)
- [Set up a Supabase app](https://tryrelia.com/docs/supabase-setup.md)
- [APIs](https://tryrelia.com/docs/apis.md)

---
All Relia docs for AI assistants: https://tryrelia.com/llms.txt (index) · https://tryrelia.com/llms-full.txt (everything in one file)
