Connection pool sizing for a small service

Back to list2026-08-20
You

How many database connections should a service with 4 workers open?

ChatGPT

Start from cores, not workers. A pool of about twice the database core count is the usual ceiling, so 8 to 16 for a small instance. Beyond that throughput flattens and latency grows, because the connections queue inside postgres instead of in your pool.

You

Should I store user settings as JSONB or as real columns?

ChatGPT

Columns for anything you filter or join on, JSONB for the long tail nobody queries. The moment you write a WHERE settings->>'plan' = ... that runs often, that key has earned a column and an index.

You

timestamptz or timestamp for event times?

ChatGPT

timestamptz almost always. It stores a point in time in UTC and converts on the way out; timestamp stores a wall clock reading with no idea which wall it was on, which becomes unrecoverable once daylight saving moves.