Updates for Supabase Functions
Supabase is shipping Database Webhooks in alpha, a convenience wrapper around Postgres triggers that fires asynchronous HTTP requests on INSERT, UPDATE and DELETE with a Realtime-style JSON payload. It also adds dashboard editors for Postgres functions and triggers, and lays out a staged roadmap toward its own serverless Supabase Functions. The networking layer is pg_net, a new Postgres extension that queues requests to a background worker using the libcurl multi interface. Queuing 10 GETs returned in 1.5 ms versus 3.5 s for the synchronous pgsql-http, and the extension handles over 300 requests per second.
Related posts
- Sub-10ms Postgres queries for Vercel Edge Functions
Neon mediumAdept
Neon's serverless Postgres driver now supports SQL-over-HTTP via fetch, and Neon's proxy adds opt-in experimental connection caching (`fetchConnectionCache`). Together they cut query latency from Vercel Serverless and Edge Functions by about 40%, bringing same-region one-shot queries to single-digit milliseconds. Use the `neon` HTTP function for a single query per invocation and `Pool` when a function runs multiple queries. Drizzle-ORM also supports the driver for type-safe queries.
- Neon Functions: backend logic next to your data
Neon mediumAdept
Neon Functions are long-running Node.js 24 compute deployed onto a Neon branch, in the same region and on the same infrastructure as its Lakebase Postgres database, with DATABASE_URL and other Neon backend credentials injected automatically. Running next to the data removes the cross-network hop per query and lets a function keep a pg Pool open across requests, so agents can stream for minutes and WebSockets or SSE can fan out via Postgres LISTEN/NOTIFY. Functions branch with the database: each child branch gets its own function copy and URL, and deleting the branch deletes it. They are declared in neon.ts, Hono is the recommended framework, and the pg Pool is recommended over the serverless driver; functions are not for frontend hosting or background jobs, and cron and event triggers are planned.
- PgBouncer is now available in Supabase
Supabase mediumAdeptSupabase now bundles PgBouncer, co-located on the same server as each new project's Postgres, so serverless functions that open a connection per request don't overwhelm the database. The pooler keeps a fixed set of connections open, currently a pool size of 15, and queues clients when all are busy rather than raising Postgres's connection limit. Three pool modes are available: session (full feature support), transaction (recommended for serverless, but no session features like prepared statements) and statement (no multi-statement transactions, suited to autocommit). Pooling applies to new projects only.
- HTTP vs. WebSockets: Which protocol for your Postgres queries at the Edge
Neon mediumAdept
Neon's serverless Postgres driver now supports SQL-over-HTTP alongside WebSockets, and benchmarks from Vercel Edge and Serverless functions (iad1 to us-east-1) show each wins in different cases. WebSockets, cut from nine to four round-trips, give ~5ms latency for queries after the first but ~37ms for a single-shot query including connection setup. HTTP is faster for one-shot queries but lacks sessions, interactive transactions, NOTIFY and COPY. An experimental proxy-side connection cache (fetchConnectionCache) saves almost 10ms by finding the compute node faster. Choose HTTP for single queries and WebSockets for multiple queries per invocation, and note the runtime matters as much as the protocol.
- Realtime: Broadcast from Database
Supabase mediumAdeptSupabase Realtime's Broadcast from Database sends database change events to clients through Postgres triggers that write to a `realtime.messages` table. Realtime reads that table via a replication slot on its WAL publication and broadcasts each new row to the target channel immediately. Compared with polling-based Postgres Changes it needs more setup (RLS policies, a trigger function using `realtime.broadcast_changes` or `realtime.send`, and private channels on the client). In return it can target specific operations, send only chosen columns, route messages to channels with SQL, and scale to tens of thousands of concurrent subscribers. `realtime.send` catches exceptions and reports errors via `pg_notify`, so a failed send does not break the trigger.