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 1nk3uQ-0005BT-JZ for pgsql-sql@arkaria.postgresql.org; Thu, 28 Apr 2022 13:10:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nk3uO-0000XX-Cr for pgsql-sql@arkaria.postgresql.org; Thu, 28 Apr 2022 13:10:12 +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 1nk3uO-0000XA-2H for pgsql-sql@lists.postgresql.org; Thu, 28 Apr 2022 13:10:12 +0000 Received: from mx1.intershop.de ([195.110.60.59]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nk3uH-0001KS-FN for pgsql-sql@lists.postgresql.org; Thu, 28 Apr 2022 13:10:11 +0000 Received: from mymail.intershop.de (jenmbs01.ad.intershop.net [10.0.87.121]) by mx1.intershop.de (Postfix) with ESMTPS id 641B45FFBA; Thu, 28 Apr 2022 15:10:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intershop.de; s=2017020601; t=1651151403; bh=CwUu+QqOZLUfHSG18Hre7XW1jL36/sW8zObPIDS8Za8=; h=From:To:Subject:Date:References:In-Reply-To:From; b=Ejx0R82009vf4WPtUPdkQFCzKt/Y1NhLtSd9okj6AFK1nnPA0DhfgW9FOV34mb4F5 VOpufvmUS0eG6esv6ZTrqVAQ40uSdeOhYFaGuUNvqMTkrdgdEXstV9kmUNr7cxT0Hd Vqsvzxi4lJgookkhXKLhabELnPaMnWsQaoXxnJS1y2DrZXMcBQ1eJuXucHTr/erOt1 lkgT9+jf6qiRBmzK3vbZirguwUrXiupXoFGwDE3+l97tRx837/zQCLlTO2tccjFb1p rst2FzBrGQfyIcLvsZ4x4kdDKRRlinU8Nhml6ASF5Z8jUysfJuHF05GevTQPQR33pS a+lsk5i7LnZjtJ1pcsjR59T4tgDxVB3fJyYLhPWBQlocE8WIfq2ASMYI2qyQF6hu24 UjKW8iaeHHi5eLzR+HSe67fndKbQ9nIZMuDhP6Pu9FL0H79mgGmjfLg5NH9o7Ng4aR wHGwG5qC4D7cvQBlll1LR1eNo0P6EiLEsTCkNuBGE/cwt/yWEOM1H1y0g0/qeVWA8H aZIv8pRY78O9JO+utIRhvb6LUjbedcbKWVmc+6XHGz8jOSn4pNPe8Vm/O1yRxa3FGN orG+RpsCCSsfx+cdK2+NbFhWMMMpOexajX+KZ+Q2fIZ+6AmyWUlboDLJJbc4xvB6Cg 9IZyzWunuLn1eGPYmrebXQWk= Received: from JENEX19-1.ad.intershop.net (10.0.87.121) by JENEX19-1.ad.intershop.net (10.0.87.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Thu, 28 Apr 2022 15:10:02 +0200 Received: from JENEX19-1.ad.intershop.net ([fe80::fca3:adda:19c9:b9ff]) by JENEX19-1.ad.intershop.net ([fe80::fca3:adda:19c9:b9ff%13]) with mapi id 15.02.0986.022; Thu, 28 Apr 2022 15:10:02 +0200 From: Marc Mamin To: Shaozhong SHI , pgsql-sql Subject: AW: xargs psql Thread-Topic: xargs psql Thread-Index: AQHYWvO4B/3tglEOaUGkBjBaOvtDlK0FS7ZJ Date: Thu, 28 Apr 2022 13:10:02 +0000 Message-ID: References: In-Reply-To: Accept-Language: de-DE, en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [195.110.60.24] x-tm-snts-smtp: 3D02F0DB62A8E48BE1F203751AE6EDF0F51A70F8E214E5EB86C2C715D0F38B512000:8 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.5 at mx1.intershop.de X-Virus-Status: Clean List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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=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) Has anyone made success with this? How to put xargs command line correctly? Regards, David