On Mon, 2023-03-13 at 12:24 -0400, Harrison Borges wrote:
Hello everyone.I’m running into severe performance problems with Postgres as I increase the number of concurrent requests against my backend. I’ve identified that the bottleneck is Postgres, and to simplify the test case, I created an endpoint that only does a count query on a table with ~500k rows. At 5 concurrent users, the response time was 33ms, at 10 users it was 60ms, and at 20 users it was 120ms.
I'm no expert on high concurrency, but for something this simple I'd expect that you're just CPU bottlenecked. Count in PostgreSQL actually has to read all the rows in the table. And yeah you can't do too many of them at the same time.