Expose monitor schema to Supabase admin#747
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a2432fc372
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - { name: intagg ,schema: extensions } | ||
| - { name: intarray ,schema: extensions } | ||
| - { name: pg_repack ,schema: extensions } | ||
| - { name: pg_stat_statements ,schema: extensions } |
There was a problem hiding this comment.
Keep pg_stat_statements reachable for pg_exporter
When Supabase uses the bundled PostgreSQL monitoring, this creates pg_stat_statements only in extensions, but the generated init SQL still sets the monitor user search path to monitor,public (roles/pgsql/templates/pg-init-template.sql:111) and pg_exporter connects as that user (roles/pg_monitor/templates/pg_exporter.env:7) while running unqualified FROM pg_stat_statements(false) queries (roles/pg_monitor/templates/pg_exporter.yml:1331). Those collector queries will fail with “function does not exist” for Supabase deployments unless the monitor search path is also updated or the exporter queries are schema-qualified, so query-performance metrics are lost.
Useful? React with 👍 / 👎.
|
Please do not merge this PR yet. I tested the current approach and it does not actually fix Supabase Query Performance. The reason is that Supabase Studio hard-codes the query performance SQL with: set search_path to public, extensions;and then runs unqualified queries against So the current PR is ineffective. The underlying conflict is:
Could you suggest the preferred direction here? For example, should the Supabase template move |
Summary
Reason
The Supabase docker compose in this repo runs postgres-meta with PG_META_DB_USER=supabase_admin, and Studio calls postgres-meta for dashboard database features. Supabase Query Performance uses unqualified pg_stat_statements queries, while Pigsty creates pg_stat_statements in the monitor schema for its PostgreSQL monitoring stack. Adding monitor to supabase_admin's search_path lets Supabase Query Performance find pg_stat_statements without moving the extension away from the schema expected by pg_exporter.
Tests