Re: How to run in parallel in Postgres
От | Lars Aksel Opsahl |
---|---|
Тема | Re: How to run in parallel in Postgres |
Дата | |
Msg-id | HE1P189MB0266377CA007E5848FECDE529D5E0@HE1P189MB0266.EURP189.PROD.OUTLOOK.COM обсуждение исходный текст |
Ответ на | Re: How to run in parallel in Postgres (Ondrej Ivanič <ondrej.ivanic@gmail.com>) |
Список | pgsql-performance |
>From: Ondrej Ivanič <ondrej.ivanic@gmail.com>
>Sent: Saturday, December 7, 2019 2:23 AM
>Cc: pgsql-performance@lists.postgresql.org <pgsql-performance@lists.postgresql.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,
>
- 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.
В списке pgsql-performance по дате отправления: