---
title: "PostgREST 12"
description: "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."
url: "https://swe.quest/articles/postgrest-12-66278193f2a64132"
canonical: "https://supabase.com/blog/postgrest-12"
source: "Supabase"
published: "2023-12-13"
difficulty: "medium"
kind: "Release"
reading_minutes: 3
tags: ["postgres","api-design","performance"]
---

# PostgREST 12

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

## Summary

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. A new Server-Timing response header reports per-phase durations for jwt, parse, plan, transaction and response. The release also adds aggregate functions (avg, count, max, min, sum) with implicit group-by through the select clause, plus media type handlers that let SQL functions return custom content types such as HTML directly from Postgres.

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)
- [Performance engineering](https://swe.quest/tags/performance.md) (Reliability & operations)

## Prerequisites

- PostgreSQL basics ([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))
- JWT authentication ([easy posts on Identity & auth](https://swe.quest/tags/identity-auth.md?difficulty=easy))

## Keywords

PostgREST, Supabase, JWT, Server-Timing, HTMX

## Related posts

- [PostgREST 9](https://swe.quest/articles/postgrest-9-20b92866c21e13eb.md): Supabase · 2021-11-27 · Medium · 2 min read · PostgreSQL, API design
  PostgREST 9 adds inner-join resource embedding via the \`!inner\` keyword, so top-level rows can be filtered by conditions on an embedded table (e.g. messages filtered by users.username).
- [PostgREST 12.2: Prometheus metrics](https://swe.quest/articles/postgrest-12-2-prometheus-metrics-d06169af1cb8495c.md): Supabase · 2024-08-16 · Medium · 2 min read · PostgreSQL, API design, Observability
  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.
- [PostgREST 13](https://swe.quest/articles/postgrest-13-412584efa365a837.md): Supabase · 2025-09-30 · Medium · 3 min read · PostgreSQL, API design, Search, Identity & auth
  PostgREST 13 adds spread syntax for to-many relationships so one-to-many and many-to-many joins can be returned as flat JSON arrays, automatic to\_tsvector conversion that enables full text search on text and json/jsonb columns (backed by a GIN index on the expression), and a maxAffected limit that throws an error when an update, delete or rpc touches too many rows.
- [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.
- [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 ...

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)
