>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,
>