Re: xargs psql - Mailing list pgsql-sql

From Rob Sargent
Subject Re: xargs psql
Date
Msg-id 79D9205D-1DE6-4C40-831D-30DE25DF5704@gmail.com
Whole thread Raw
In response to AW: xargs psql  (Marc Mamin <M.Mamin@intershop.de>)
Responses Re: xargs psql  (Shaozhong SHI <shishaozhong@gmail.com>)
List pgsql-sql

> On Apr 28, 2022, at 6:10 AM, Marc Mamin <M.Mamin@intershop.de> wrote:
>
> Hello , it works for me.
> I remember some difficulties with quote escaping. That's while  I'm using $$ quoting for the sql aguments.
>
> here is how ma commands look like:
>
> psqlexec="psql -h$pghost -p$pgport -U$pguser -d${pgdb} -1 -P  format=u -tqX";
>
> $psqlexec -c "SELECT relname FROM pg_class WHERE ..." \
> | xargs -n 1 -P 8 -I{} bash -c "$psqlexec -c 'select * from foo(\$\${}\$\$)' > ouputdir/{}.out"
>
> HTH,
>
> Marc Mamin
> ________________________________________
> Von: Shaozhong SHI <shishaozhong@gmail.com>
> Gesendet: Donnerstag, 28. April 2022 13:32:42
> An: pgsql-sql
> Betreff: xargs psql
>
> Running lots of postgres commands in parallel | Mark's blog
(markandruth.co.uk)<https://markandruth.co.uk/2016/05/26/running-lots-of-postgres-commands-in-parallel>
>
> Has anyone made success with this?
>
> How to put xargs command line correctly?
>
> Regards,
>
> David
>
You might be better off with gnu parallel
>



pgsql-sql by date:

Previous
From: Marc Mamin
Date:
Subject: AW: xargs psql
Next
From: Shaozhong SHI
Date:
Subject: Re: xargs psql