How Non-Technical Teammates Can Explore a Supabase Database Safely Through Postgres Roles and Curated Views
Read-only roles, curated views, and row policies keep Supabase data safe.

Analytics for Supabase teams should help non-technical teammates get answers without giving them production admin credentials. Dedicated read-only Postgres roles scoped to curated views provide that foundation, while row-level policies restrict which records each explorer can read. Safe self-service needs all three boundaries to work together, along with shared metric definitions so people who have access get consistent answers.
Why the default Supabase role setup is not built for human explorers
Supabase’s built-in roles route application requests to the database with checks for authenticated and unauthenticated sessions. The hierarchy serves that purpose. supabase_admin is the only true superuser, while postgres has privileged access below it. dashboard_user is a legacy role, and dashboard queries now run as postgres. The API layer uses authenticator, anon, authenticated, and service_role to handle app traffic.
Within that layer, authenticator receives inbound requests and switches to the target role based on the JWT. Grants and row-level security policies then shape access for anon and authenticated. The platform’s timeouts also reflect the workload, with shorter allowances for anonymous connections and longer ones for authenticated connections. Those limits suit fast client requests. They are not calibrated for exploratory queries that join multiple tables.
A teammate connecting through a database GUI, connected spreadsheet, or shared SQL client enters a different access path. That connection is a live database session. The distinction creates a practical permissions gap. Sharing the postgres admin password is a common workaround, but it gives privileged access to someone who only needs to inspect a number. The application’s permission model has not become a safe exploration model merely because the person connecting works for the same company.
What read-only really means — and where it stops protecting you
A properly restricted read-only role prevents writes through database permissions. This is the first essential boundary for exploration. An accidental query should not be able to change records simply because the person running it misunderstood the interface. However, preventing modification says nothing about whether the readable data is appropriate for that person.
PostgreSQL 14 added pg_read_all_data, which lets a role read every table, view, and sequence without giving it write or admin power. Its breadth is also its limitation. A later migration could add reporting.raw_exports, and the role would gain access without a separate review of that table. Controlled exploration requires an explicit, reviewed list of readable objects.
A support representative with table-wide SELECT permission on users can run SELECT * FROM users and receive password hashes, API keys, and phone numbers. The query changes nothing in the database. It can still disclose data that the representative should never see. Static roles do not rewrite sensitive values in query results, so read-only access must be paired with a deliberate choice of what the user can read.
Building the layered permission boundary: role, view, and row-level fence

The build begins with a dedicated analytics role, such as analytics_ro, with no superuser, role-creation, or database-creation privileges. A short declaration illustrates those restrictions, namely CREATE ROLE analytics_ro LOGIN NOSUPERUSER NOCREATEROLE NOCREATEDB. Its grants should cover only reviewed objects. Each person or integration also needs a separate login so activity can be attributed and access revoked individually.
The next layer defines the readable surface through curated views. These views pre-join related tables, rename columns in business terms, and omit sensitive fields. A view over users and orders can expose first_name, plan, order_total, and created_at without exposing password_hash, stripe_customer_id, or phone. The intended boundary is view-only access for the explorer. The view becomes the contract presented in the teammate’s client.
Row filtering requires a separate check of that contract. Supabase’s RLS documentation warns that views created by postgres bypass RLS by default because they use the creator’s privileges. In Postgres 15+, security_invoker = true makes a view use the querying role’s permissions and underlying row policies. That setting must be reconciled with the required underlying permissions, rather than treated as a switch that automatically makes a view-only grant sufficient. The complete access path needs review as one boundary.
Grants decide whether an operation is allowed, while RLS policies decide which rows it can affect. Supabase’s documentation describes RLS as adding a WHERE clause to queries and calls it “defense in depth” because it operates inside the database, including through third-party tools. Adding policies does not revoke existing grants, so those grants need review too. If a policy filters by user_id, that column needs an index to avoid scanning rows and evaluating the predicate across the table.
Finally, the analytics role needs a workload guardrail. ALTER ROLE analytics_ro SET statement_timeout = '30s' illustrates a role-level timeout that cancels runaway exploration. It allows more room than the platform’s 3-second and 8-second app-traffic timeouts without leaving an expensive cross join unrestricted.
Why views alone are not enough once AI agents are querying the same database
AI agents face the same permission problem as human explorers, but it is harder to predict what queries they will run. A hallucinated or overly broad query can be followed by further attempts without a pause for reconsideration. Direct production access adds two distinct risks. Concurrent sessions can exhaust the connection pool, while a privileged connection can bypass row-level security. A curated view does not compensate for an agent that also holds broader credentials.
AI query tools should use only the restricted analytics access path. Application-level claims of read-only behavior are not enough. The AWS security bulletin for CVE-2026-85787 describes an incomplete disallowed-input list in Amazon’s awslabs/postgres-mcp-server before version 1.1.7 that could allow modification beyond the read-only scope. Crafted SQL processed through the MCP workflow could cross that boundary. The bulletin identifies upgrading to version 1.1.7 as the fix and separately recommends a minimal-privilege Postgres role as an additional defense.
An MCP server that queries that copy rather than live Postgres keeps agent query traffic and write attempts away from the production instance. The Model Context Protocol also replaces separate connectors between every agent and data component with a common integration layer, changing the integration pattern from N×M to N+M. A shared protocol simplifies connectivity, but the governed dataset remains the security boundary behind it.
What the data surface should look like — and what it should never expose
For developers designing these views, the starting point is what the business needs to learn. Order totals, cohort counts, and plan distribution can answer useful questions without showing every record behind them. With pre-joined data, people can explore without having to learn as much about the schema. Names such as customer_name and plan_tier communicate more than profiles.full_name and subscriptions.stripe_price_id. Useful date fields let people track trends without seeing timestamps that show how the system works inside.
Sensitive columns should be absent by design. Password hashes, API keys, reset tokens, and identifiers such as stripe_customer_id do not belong in a general reporting surface. Email addresses, phone numbers, national IDs, and card-related fields should be excluded when they are unnecessary for what the business needs to learn. The same principle applies to internal-only columns. Fields such as created_by_trigger and UUIDs used only for joins do little to help the reader but reveal how the system is built.
A clear contract needs names that will last and a workload it can handle, with names such as reporting.monthly_signups and reporting.active_subscribers telling readers what the data is for, while public.users_joined_v2 tells them how it was built. Naming alone will not preserve performance, however. A dashboard that runs live COUNT queries across full tables on every load will be harder to keep running well as those tables grow. For that pattern, maintaining counters on write or refreshing a materialized view on a schedule gives the dashboard a prepared result to read.
Keeping the analytics surface honest — observability before it becomes a user complaint
Once the access path is in place, observability becomes part of operating it. A curated view can remain correctly permissioned while becoming too slow for the people using it. The team needs visibility before complaints arrive. For the analytics workload, the team needs to watch how query costs add up, how much pressure connections put on the database, and how the data grows, even when access works.
pg_stat_statements is a starting point for seeing how queries perform. A query taking 40ms but running hundreds of times per page load can consume more database time than a 900ms report that nobody opens. Per-execution latency alone misses that distinction. Total time across executions identifies the queries responsible for the larger workload. Slow query logging then makes regressions visible as operational data, while table and index size tracking gives warning of growth that may require partitioning.
Active connections need to be checked against max_connections, because having most of that capacity in use is a warning even if some room is left. Idle-in-transaction connections held for more than a few minutes are bugs. They occupy connection slots without useful progress.
The access layer solves self-service — the metrics layer solves alignment
Four people reading the same tables can produce four answers because each applies a different definition. Growth may read one number, marketing another from an ad platform, finance a separate export, and the CEO a fourth version in a weekly email. All of those sources can be working as they should. The disagreement begins when “monthly active users” or “churned accounts” has never been defined once and computed consistently.
A metrics layer, sometimes called headless BI, addresses that gap by defining business metrics in code and serving them to downstream consumers. Dashboards, Slack digests, investor reports, and AI agents querying over MCP can then use the same governed definition. This is a distinct requirement from connectivity. For teams evaluating BI tools that connect directly to Supabase, the useful criteria include restricted access, production workload isolation, and shared metric definitions.
Document definitions for active users, qualified leads, booked revenue, churned accounts, and retained cohorts early, establishing agreed meanings before disputes become expensive. The choice of governing metrics also changes with stage. Before product-market fit, activation rate tracks the share of new signups reaching the product’s “aha moment” in the first session. At Series A and beyond, the governing measures include net revenue retention, gross revenue retention, logo churn, revenue churn, LTV to CAC, and Magic Number.
One implementation option is Dreambase, an AI-native analytics layer that serves governed, pre-modeled datasets to human teammates and AI agents, with native Supabase authentication controlling access. Its agents query governed Parquet datasets through a single MCP server instead of live Postgres, while pre-calculated KPIs reach inbox, Slack, and mobile from the shared metrics layer.
Where role-based controls reach their limit — and what comes after
Static roles restrict an account’s permissions. A person or agent can still issue an unexpected query within the permitted surface. Roles do not request peer approval, dynamically mask a sensitive column accidentally included in a view, or recover individual attribution from shared credentials. Those are separate controls with separate purposes.
For teams facing those gaps, an additional option is a data-loss-prevention inspection layer between the MCP server and the agent. Such a proxy inspects queries before execution, masks matched sensitive columns in results, and logs decisions for audit. Evaluation becomes more pressing as agent workloads reach production volume or compliance obligations require finer-grained records. For most Supabase teams that are still early in their growth, dedicated roles, curated views, and row-level policies are the right place to start.


