Re: How to run in parallel in Postgres

From: Lars Aksel Opsahl <Lars(dot)Opsahl(at)nibio(dot)no>
To: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>
Cc: "pgsql-performance(at)lists(dot)postgresql(dot)org" <pgsql-performance(at)lists(dot)postgresql(dot)org>
Subject: Re: How to run in parallel in Postgres
Date: 2019-12-07 11:17:25
Message-ID: HE1P189MB0266377CA007E5848FECDE529D5E0@HE1P189MB0266.EURP189.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

>From: Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com>

>Sent: Saturday, December 7, 2019 2:23 AM

>Cc: pgsql-performance(at)lists(dot)postgresql(dot)org <pgsql-performance(at)lists(dot)postgresql(dot)org>

>Subject: Re: How to run in parallel in Postgres

>

>Hi Lars,

>

>I have two suggestions:

>

>- `xargs` almost always present and it can run in parallel (-P) but script needs to be changed:

>for((i=1;i<=28;i++)); do echo "SELECT find_overlap_gap_single_cell('test_data.overlap_gap_input_t1','geom',4258,'test_data.overlap_gap_input_t1_res',${I},28);"; done | xargs -n1 -P 10 psql ...

>

>- `UNION ALL` might trigger parallel execution (you need to mess with the cost of the function and perhaps other settings):

>SELECT

> find_overlap_gap_single_cell('test_data.overlap_gap_input_t1','geom',4258,'test_data.overlap_gap_input_t1_res',1,28)

>UNION ALL

>SELECT

> find_overlap_gap_single_cell('test_data.overlap_gap_input_t1','geom',4258,'test_data.overlap_gap_input_t1_res',2,28)

>...

>

>

>Cheers,

>

Hi Ondrej

* Yes using xargs seems be an alternative to GNU parallel and I will have that in mind.
* I did a test using UNION ALL in the branch https://github.com/larsop/find-overlap-and-gap/tree/union_all_parallel but I was not able to trigger Postgres parallel . That may be related to what Justin say about create tables.

Thanks.

Lars

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Lars Aksel Opsahl 2019-12-07 11:27:56 Re: How to run in parallel in Postgres
Previous Message Justin Pryzby 2019-12-07 01:25:21 Re: How to run in parallel in Postgres