Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nk4lo-0001vs-9f for pgsql-sql@arkaria.postgresql.org; Thu, 28 Apr 2022 14:05:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nk4ln-0000UQ-3m for pgsql-sql@arkaria.postgresql.org; Thu, 28 Apr 2022 14:05:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nk4lm-0000UH-OQ for pgsql-sql@lists.postgresql.org; Thu, 28 Apr 2022 14:05:22 +0000 Received: from mail-ej1-x629.google.com ([2a00:1450:4864:20::629]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nk4lk-0001rg-Ca for pgsql-sql@lists.postgresql.org; Thu, 28 Apr 2022 14:05:22 +0000 Received: by mail-ej1-x629.google.com with SMTP id bv19so9796467ejb.6 for ; Thu, 28 Apr 2022 07:05:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=XmiB/Ldr4b1hMQmOAfGQoQROJ/V5aVb8bFKMANLbC/U=; b=Tm4oS5p6aQU9rrYBoTAIpixpz5LCxeTDJnlVWRRh/XUY1mFTOr+qupVu3COTwmF+ys fUN8AQ19Egu6/ZFSNx22kflhEhMEQt2/DsyC0SzUxQthWeppUdoKaue8Qexc1eQavjPP KZbv8D6TKra0co1xtdEZsx51NL/QjgLQF65o5xxuQhg17sCevrUkCvVG5eTvX3DyMmgd ++hOaUbGFEofdOggmOUUZ8uKV6eSdizQ3D0k2hMvWNio5d9VLF/zpRMpS1V9VfL6kYf3 bL7cpu6uSSim5MDQixxD74PeELr/O3Pip2oBumWayX+yvX+4qWW4S7PiZ5FxPpGPetEp AP0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=XmiB/Ldr4b1hMQmOAfGQoQROJ/V5aVb8bFKMANLbC/U=; b=P74NbABQ3nyC8ykkVHrWLU/uiO18l51P6xRsgliCWexPYj/5DH2c0mZxmQbAT358eK SC1+02TgSEuoWX5Fd4bySlKQdDsp+ev+drRR45SiMHLncSes9hJH/RdqurO0DIxBJGKp Ef+53hrjSvQKKVX/x/cAgnhEZO43AjYHlrXOwCDwgUYqaSiqd//c0HVf9Vl+tngQqsBB zXdZjNu6mlPYb66Ngc2cYrsp6DAvLLgP/lukrYGtKCr71kIHrGAaShu4FkWR/l9PCYWl EhbcPYGcL8ymlxzHVyQWeFU3PHVghFJ3kfC2xviB7YxRDH4RX1by/SvbF4f5D0zEvgwL Iq/g== X-Gm-Message-State: AOAM531GoafhP5ZjN3UXXK2ciEsBjKzkhR2DbWeUgPqZvi2UmCUYjuws 5aWkL5Y7GpXWcDc2Abs664QVUmLL9enlr4P0hPE= X-Google-Smtp-Source: ABdhPJwPULC6KJJWZkDNHvxUY3uP5FCy5YOYRzvMpv3C0Ih63KsCPlbKu1i7WRFbfFrfvNBbOLK4pWUoEP8F6kJuWVE= X-Received: by 2002:a17:907:94c9:b0:6e8:ab67:829e with SMTP id dn9-20020a17090794c900b006e8ab67829emr31204911ejc.313.1651154718463; Thu, 28 Apr 2022 07:05:18 -0700 (PDT) MIME-Version: 1.0 References: <79D9205D-1DE6-4C40-831D-30DE25DF5704@gmail.com> In-Reply-To: <79D9205D-1DE6-4C40-831D-30DE25DF5704@gmail.com> From: Shaozhong SHI Date: Thu, 28 Apr 2022 15:05:07 +0100 Message-ID: Subject: Re: xargs psql To: Rob Sargent Cc: Marc Mamin , pgsql-sql Content-Type: multipart/alternative; boundary="00000000000076989605ddb76a71" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000076989605ddb76a71 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Some suggested using no_hup. Would that work? Regards, David On Thu, 28 Apr 2022 at 15:00, Rob Sargent wrote: > > > > On Apr 28, 2022, at 6:10 AM, Marc Mamin wrote: > > > > =EF=BB=BFHello , 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=3D"psql -h$pghost -p$pgport -U$pguser -d${pgdb} -1 -P format= =3Du > -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 > > 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 > > > --00000000000076989605ddb76a71 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Some suggested using no_hup.=C2=A0 =C2=A0Would that work?<= div>
Regards,

David

<= div class=3D"gmail_quote">
On Thu, 28 = Apr 2022 at 15:00, Rob Sargent <robjsargent@gmail.com> wrote:


> On Apr 28, 2022, at 6:10 AM, Marc Mamin <M.Mamin@intershop.de> wrote:
>
> =EF=BB=BFHello , it works for me.
> I remember some difficulties with quote escaping. That's while=C2= =A0 I'm using $$ quoting for the sql aguments.
>
> here is how ma commands look like:
>
> psqlexec=3D"psql -h$pghost -p$pgport -U$pguser -d${pgdb} -1 -P=C2= =A0 format=3Du -tqX";
>
> $psqlexec -c "SELECT relname FROM pg_class WHERE ..." \
> | xargs -n 1 -P 8 -I{} bash -c "$psqlexec -c 'select * from f= oo(\$\${}\$\$)' > 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 (markan= druth.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
>
--00000000000076989605ddb76a71--