This message can happen if queries are coming in faster than the pool can answer them - for instance, if queries take 1s to complete but the system makes 20 per second.
Increasing the pool size may help with this, but it will also increase the load on the database. Don’t change it without understanding the consequences.
You should also investigate which queries are taking so long. If there’s one particular part of your system that makes long-running queries, consider isolating it with a separate connection pool and put_dynamic_repo
.
It’s also worth checking on the slow queries: are there ways to make them faster? Missing indexes? Reordered SQL clauses? EXPLAIN ANALYZE
will be useful here, so if you’re on the latest Ecto check out Ecto.Adapters.SQL.explain