#5257·postgrest

Add metric for pool wait time

Author: steve-chavezCreated Sep 17, 2026Updated Sep 17, 2026
Labelsidea

Problem

The current pgrst_db_pool_waiting is not enough to measure pool queue latency. We need to bench this so we can check if our pool is able to saturate pg connections https://github.com/PostgREST/postgrest/discussions/5227#discussioncomment-18363723

Poolers like hikaricp offer a pool wait metric.

Solution

Add a pgrst_db_pool_wait_time_seconds metric that captures each request pool acquisition time. hasql pool already has the pool acquisition timeout, so I'm lead to believe this won't have much perf impact since it already does timing.

We could also add this to:

Server-Timing:
  ...
  pool;dur=33.3,
  transaction;dur=66.6