On Mon, Jan 29, 2018 at 3:19 PM, Jan De Moerloose <jan@sensolus.com> wrote:
The state is 'idle in transaction'.
So you have long-running *transactions*, not queries. This is not good for an OLTP system, because some transaction can wait of others, which are "idle in transaction" but do nothing at the moment. Think how you can make them shorter, commit faster.
Also, if your server version is 9.6+ consider setting idle_in_transaction_session_timeout to some low value: