---
title: "PostgREST 12.2: Prometheus metrics"
description: "PostgREST 12.2 adds Prometheus-compatible metrics for its schema cache and connection pool, such as pgrst_db_pool_timeouts_total, to help diagnose problems like pool starvation."
url: "https://swe.quest/articles/postgrest-12-2-prometheus-metrics-d06169af1cb8495c"
canonical: "https://supabase.com/blog/postgrest-12-2"
source: "Supabase"
published: "2024-08-16"
difficulty: "medium"
kind: "Release"
reading_minutes: 2
tags: ["postgres","api-design","observability"]
---

# PostgREST 12.2: Prometheus metrics

A post on [Supabase](https://swe.quest/sources/supabase.md), published 2024-08-16, 2 min read, Release. Original: [https://supabase.com/blog/postgrest-12-2](https://supabase.com/blog/postgrest-12-2)

## Summary

PostgREST 12.2 adds Prometheus-compatible metrics for its schema cache and connection pool, such as pgrst\_db\_pool\_timeouts\_total, to help diagnose problems like pool starvation. Function-level settings such as statement\_timeout are now "hoisted" and applied per transaction when the function is called through RPC, so a single function can have its own timeout without changing the API role for every statement. Other settings can be added to the hoisted list via db-hoisted-tx-settings. A new max-affected Prefer header caps how many rows a mutation can touch, returning PGRST124 when the cap is exceeded under strict handling.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [API design](https://swe.quest/tags/api-design.md) (Backend & APIs)
- [Observability](https://swe.quest/tags/observability.md) (Reliability & operations)

## Prerequisites

- PostgreSQL functions ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- REST APIs ([easy posts on API design](https://swe.quest/tags/api-design.md?difficulty=easy))
- Prometheus basics

## Keywords

PostgREST, Prometheus, Supabase, statement\_timeout, max-affected

## Related posts

- [What is new in PostgREST v11.1?](https://swe.quest/articles/what-is-new-in-postgrest-v11-1-2bc974a578068114.md): Supabase · 2023-07-12 · Medium · 5 min read · PostgreSQL, API design, Consistency models, SQL
  PostgREST 11.1 lets impersonated JWT roles (anon, authenticated, service\_role) carry Postgres settings via ALTER ROLE ...
- [PostgREST 12](https://swe.quest/articles/postgrest-12-66278193f2a64132.md): Supabase · 2023-12-13 · Medium · 3 min read · PostgreSQL, API design, Performance engineering
  PostgREST 12 caches validated JWTs using the token's exp claim as the cache lifetime, cutting server-side JWT handling in the example from about 148ms to 14ms per request.
- [Own Your Observability: Supabase Metrics API](https://swe.quest/articles/own-your-observability-supabase-metrics-api-f7b0d82ff7186f0c.md): Supabase · 2025-12-16 · Medium · 4 min read · Observability, PostgreSQL
  Supabase's Metrics API exposes roughly 200 Postgres health and performance metrics per project in Prometheus exposition format at a privileged endpoint authenticated with service-role Basic Auth, refreshed every minute.
- [PostgREST v10: EXPLAIN and Improved Relationship Detection](https://swe.quest/articles/postgrest-v10-explain-and-improved-relationship-detection-44878c605b0df57d.md): Supabase · 2022-08-19 · Medium · 7 min read · PostgreSQL, API design, Performance engineering
  PostgREST v10 adds HTTP-level EXPLAIN support: requests with the \`application/vnd.pgrst.plan\` media type, or supabase-js's \`explain()\` transform, return the PostgreSQL execution plan for reads, writes and RPC, which helps verify that RLS policies are applied and gives you the pg\_stat\_statements query identifier.
- [PostgREST Aggregate Functions](https://swe.quest/articles/postgrest-aggregate-functions-f622df6532444e20.md): Supabase · 2024-02-29 · Medium · 7 min read · PostgreSQL, API design, SQL
  PostgREST v12 adds on-the-fly aggregate functions (avg, count, max, min, sum) to its API.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
