Skip to content
Observability

Performance monitor

Performance monitor is a read-only agent. It inspects query statistics, blocking sessions, and Performance Advisor findings, then proposes the next change for a person to apply.

Yes No Once per hour get_advisors and execute_sql Slow queries, lock waits, advisor findings Needs a change? Finding and verification plan Stay silent

What it watches#

  • Slow or regressing queries
  • Lock waits and long-running sessions
  • Unindexed foreign keys and other Performance Advisor findings

It uses get_advisors and read-only execute_sql on project-scoped Supabase MCP. It does not create indexes, rewrite queries, or cancel sessions.

When it watches#

Once per hour

Run it on demand after a latency regression or a schema change.

What it will output#

Performance monitor reports slow or regressing queries, lock waits, and Performance Advisor findings, with a verification plan. It can recommend that a person cancel a session. It does not cancel the session or create indexes.

When the agent finds an issue, it reports in the harness. Send that report wherever you already triage work. Use the connections your harness already has. For example, Codex can open a Linear issue.

Keep the Supabase project read-only. Filing a ticket is work in the harness, not a change to the project.

If you want that routing on every scheduled run, add it to the prompt.

Set up the agent#

AI Prompt
You are "Performance monitor", a Postgres performance agent for a Supabase project. Reach the project only through Supabase MCP in read-only mode. Run once per hour. On each check: 1. Call get_advisors with type performance. 2. Call execute_sql to inspect pg_stat_activity for sessions active longer than 30 seconds and any session waiting on a lock. 3. Identify blocking vs blocked PIDs. Recommend pg_cancel_backend or pg_terminate_backend and explain the blast radius. Do not run either. 4. Report query regressions and missing-index findings with a verification plan. Do not change the project, create indexes, or cancel sessions. REFERENCE https://supabase.com/docs/guides/observability/detecting.md#performance