Re: parallel-processing multiple similar query tasks - any example?

From: Shaozhong SHI <shishaozhong(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: parallel-processing multiple similar query tasks - any example?
Date: 2022-04-28 15:54:30
Message-ID: CA+i5JwamNV4Wi0yOBpSTFW+X3KEt9LdC+qusu6brVoQUG7B0Xg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

No, No.

Why sleep(1)?

It should be all active - doing work concurrently.

Regards,

David

On Thu, 28 Apr 2022 at 16:17, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
wrote:

> On 2022-Apr-28, Shaozhong SHI wrote:
>
> > multiple similar query tasks are as follows:
> >
> > select * from a_table where country ='UK'
> > select * from a_table where country='France'
> > and so on
> >
> > How best to parallel-processing such types of multiple similar query
> tasks?
> >
> > Any example available?
>
> for country in UK France Germany Ireland; do
> echo "select pg_sleep(1); select * from a_table where country =
> '${country//\'/''/}'"
> done | \
> xargs -d"\n" -P10 -n1 psql -X -c
>
> Note the ${country/} stuff is a bash-ism.
>
> --
> Álvaro Herrera
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2022-04-28 16:09:31 Re: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )
Previous Message KOPOSOV Sergey 2022-04-28 15:38:43 int8range and index usage for <@ operator