Re: parallel-processing multiple similar query tasks - any example? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: parallel-processing multiple similar query tasks - any example?
Date
Msg-id 202204281517.nznd535364hn@alvherre.pgsql
Whole thread Raw
In response to parallel-processing multiple similar query tasks - any example?  (Shaozhong SHI <shishaozhong@gmail.com>)
Responses Re: parallel-processing multiple similar query tasks - any example?  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-general
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



pgsql-general by date:

Previous
From: "Burke, William J Collins"
Date:
Subject: ERROR: cursor variable must be a simple variable (LINE XX: OPEN vQuery.cursorReturn FOR )
Next
From: KOPOSOV Sergey
Date:
Subject: int8range and index usage for <@ operator