Enabling Parallel Queries in PostgreSQL 9.6

There is a pretty good feature which is introduced in PostgreSQL 9.6 that is parallel query where the planner can leverage multiple CPU in order to answer the queries faster.
As of 9.6 parallel queries are disabled by default.
There are two ways to enable it.

1. Database Level

This will have impact on all the queries which are running, to enable this setting go to postgresql.conf and enable max_parallel_workers_per_gather parameter and set it to the number of CPU’s that you want the parallel query to use.

2. Session Level

 This will have impact only on the queries running for that session.
Set the max_parallel_workers_per_gather parameter to the number of CPU’s you want the parallel query to use. (It should be less than the actual CPU  available on the system)

You can use the following command to see if that is done.

0 comments… add one

Leave a Comment