public inbox for [email protected]  
help / color / mirror / Atom feed
xargs psql
5+ messages / 3 participants
[nested] [flat]

* xargs psql
@ 2022-04-28 11:32  Shaozhong SHI <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Shaozhong SHI @ 2022-04-28 11:32 UTC (permalink / raw)
  To: pgsql-sql <[email protected]>

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


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* AW: xargs psql
@ 2022-04-28 13:10  Marc Mamin <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Marc Mamin @ 2022-04-28 13:10 UTC (permalink / raw)
  To: Shaozhong SHI <[email protected]>; pgsql-sql <[email protected]>

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 <[email protected]>
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





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: xargs psql
@ 2022-04-28 13:59  Rob Sargent <[email protected]>
  parent: Marc Mamin <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Rob Sargent @ 2022-04-28 13:59 UTC (permalink / raw)
  To: Marc Mamin <[email protected]>; +Cc: Shaozhong SHI <[email protected]>; pgsql-sql <[email protected]>



> On Apr 28, 2022, at 6:10 AM, Marc Mamin <[email protected]> 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 <[email protected]>
> 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 
> 





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: xargs psql
@ 2022-04-28 14:05  Shaozhong SHI <[email protected]>
  parent: Rob Sargent <[email protected]>
  0 siblings, 1 reply; 5+ messages in thread

From: Shaozhong SHI @ 2022-04-28 14:05 UTC (permalink / raw)
  To: Rob Sargent <[email protected]>; +Cc: Marc Mamin <[email protected]>; pgsql-sql <[email protected]>

Some suggested using no_hup.   Would that work?

Regards,

David

On Thu, 28 Apr 2022 at 15:00, Rob Sargent <[email protected]> wrote:

>
>
> > On Apr 28, 2022, at 6:10 AM, Marc Mamin <[email protected]> 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 <[email protected]>
> > 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
> >
>


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: xargs psql
@ 2022-04-28 14:53  Rob Sargent <[email protected]>
  parent: Shaozhong SHI <[email protected]>
  0 siblings, 0 replies; 5+ messages in thread

From: Rob Sargent @ 2022-04-28 14:53 UTC (permalink / raw)
  To: Shaozhong SHI <[email protected]>; +Cc: pgsql-sql <[email protected]>



> On Apr 28, 2022, at 7:05 AM, Shaozhong SHI <[email protected]> wrote:
> 
> Some suggested using no_hup.   Would that work?
> 
> Regards,
> 
> David
No not like gnu parallel.






^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2022-04-28 14:53 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28 11:32 xargs psql Shaozhong SHI <[email protected]>
2022-04-28 13:10 ` AW: xargs psql Marc Mamin <[email protected]>
2022-04-28 13:59   ` Rob Sargent <[email protected]>
2022-04-28 14:05     ` Shaozhong SHI <[email protected]>
2022-04-28 14:53       ` Rob Sargent <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox