On Wed, Jan 13, 2016 at 11:51 AM, Jeff Janes <jeff.janes@xxxxxxxxx> wrote:
Anyway, it looks to me like you have a checkpoint problem. The checkpoint overwhelms your IO system. The overwhelmed IO system then backs up into the bgwriter. What you see in the bgwriter is just a symptom, not the cause. The background writer is usually not very useful in recent versions of PostgreSQL, anyway. But, the same IO problem that is clogging up the background writer is also clogging up either your buffer_backend, or your WAL writes/fsyncs. And both of those will destroy your throughput.
That was my intuition too. Not enough I/O available from the hardware for the workload requested.
As recommended, log your checkpoints and try tuning them to spread the load.