Postgresql – Postgres parallel seq scan making high CPU Utilization

parallelismpostgresql-10

When I run a select query which runs on a view in Postgres, it is starting 3 processes for a single query, which is causing high CPU utilization when multiple job runs in parallel.

How to avoid using parallel sequential scans and increase my query performance at the same time?

Best Answer

You can disable parallel query by setting max_parallel_workers_per_gather to 0 in postgresql.conf.

Then the only ways of speeding up processing are

  • keep the table cached in RAM

  • avoid a sequential scan by creating an index

If possible, the second way is much better.