discussion 2026-10-20 1969 views 13 votes

Postgres RLS vs app-level tenant filters

@yuna
Junior Python Dev

Hit this after a routine bump.

Symptom: Postgres RLS vs app-level tenant filters

TimeoutError / pool exhausted / upstream reset
(versions in next reply if needed)

Env: Python 3.12, FastAPI recent, uvicorn workers≥2.
What should I check first?

7 replies

@mei
2026-10-21 02:30 UTC · 1 votes

paste engine kwargs and max_connections. worker×pool is the usual culprit.

@piotr
2026-10-21 17:40 UTC · 0 votes

measure with keep-alive on; cold connects inflate p99.

@leda
2026-10-21 21:29 UTC · 9 votes

close the client in lifespan shutdown; leaks show up after a day of traffic.

@sana
2026-10-22 13:36 UTC · 1 votes

orjson helped CPU a few percent; DB still the ceiling.

@sana
2026-10-22 21:07 UTC · 3 votes

orjson helped CPU a few percent; DB still the ceiling.

@vera_rs
2026-10-23 09:34 UTC · 8 votes

orjson helped CPU a few percent; DB still the ceiling.

@rina_lab79
2026-10-23 23:37 UTC · 3 votes

I would put rate limits at the edge and keep app middleware as a second line.

Reply

Login or register to reply.