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 1nda2B-0008Ls-1v for pgsql-sql@arkaria.postgresql.org; Sun, 10 Apr 2022 16:03:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nda28-0003jR-52 for pgsql-sql@arkaria.postgresql.org; Sun, 10 Apr 2022 16:03:24 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nda27-0003jG-RE for pgsql-sql@lists.postgresql.org; Sun, 10 Apr 2022 16:03:23 +0000 Received: from premium22-1.web-hosting.com ([68.65.122.103]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nda25-0000L9-2Y for pgsql-sql@lists.postgresql.org; Sun, 10 Apr 2022 16:03:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=misuse.org; s=default; h=Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=3AdPzRqPld0tAnp9wTHuXzIx5zSOnqyp/8zVU/CEcHE=; b=AP6CxzfzwaqWdDlcOZ7LTyPjbO 5k7yTvuJzqUTnssy0yPxQAJw5hPfIksU3M0NM//WwodyAnvIcWkKh08FWT3ZVZRkJUBHpcp5OiRRx 1FpVxTeMbKajw5aEcGV0fVAV9xFzpq3EzOTvR3zhBubvTAmjR92LZl1bQfzuyLRoGvlo6yfah1jXg vwp5zSG9CPpdt1u3ZYT7M07K6PiRQOq9ahoctyz0FR6BGnlA/xnZyyLTbuS7STYSGNZJRvM6BC9+9 Pzy4H99TsDLNOzuyWcYuerm1WmVIvhxQU/Xs8eQ7L3bTccQ6BcxnupdjhUJM+KqNFF3Y5m7kCt+1G BIO7NlOw==; Received: from mail-qk1-f175.google.com ([209.85.222.175]:38778) by premium22.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nda1y-000CHj-Ul for pgsql-sql@lists.postgresql.org; Sun, 10 Apr 2022 12:03:19 -0400 Received: by mail-qk1-f175.google.com with SMTP id 3so1427528qkj.5 for ; Sun, 10 Apr 2022 09:03:14 -0700 (PDT) X-Gm-Message-State: AOAM531arpYfLzzwbU74EwjCozXwzhio8h7pUDqRTP4mjT2V8WVq6Y6r KcgnYglYUCz0qbWcAJpktqwLPLJOb+1G+/7RohE= X-Google-Smtp-Source: ABdhPJzxyeRLPa3P+Vep+pWfqsVn5jYxrsr8NZAwjK4+gm3SWDpafon9jw+inCXNqoQWE1aBPn8lHqzw9aet5hbhQ84= X-Received: by 2002:a37:a346:0:b0:69c:d5b:9e99 with SMTP id m67-20020a37a346000000b0069c0d5b9e99mr2956966qke.199.1649606593878; Sun, 10 Apr 2022 09:03:13 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Steve Midgley Date: Sun, 10 Apr 2022 09:03:04 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: How best to do parallel query given tens of thousands of iteration of a loop of recursive queries? To: Shaozhong SHI Cc: pgsql-sql Content-Type: multipart/alternative; boundary="0000000000000c213105dc4ef75f" X-OutGoing-Spam-Status: No, score=3.2 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium22.web-hosting.com X-AntiAbuse: Original Domain - lists.postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - misuse.org X-Get-Message-Sender-Via: premium22.web-hosting.com: authenticated_id: science@misuse.org X-Authenticated-Sender: premium22.web-hosting.com: science@misuse.org X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000c213105dc4ef75f Content-Type: text/plain; charset="UTF-8" On Sun, Apr 10, 2022, 6:50 AM Shaozhong SHI wrote: > There is a plpgsql script that have a loop to carry out the same recursive > queries. > > The estimation of iteration is in the order of tens of thousands. > > What is the best way of making using parallel query strategy. > > Any examples? > Can you provide some sample ddl, data and sql to illustrate your question? You mention in one place "iteration" and "parallel" but in another you mention recursion.. Recursion (by definition?) involves pushing state data forward into each successive iteration.. Therefore you can't run recursion in parallel. If you can provide examples maybe we can see which if parallelism is a possibility.. Steve --0000000000000c213105dc4ef75f Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Sun, Apr 10, 2022, 6:50 AM Shaozhong SHI &= lt;shishaozhong@gmail.com>= wrote:
There is a= plpgsql script that have a loop to carry out the same recursive queries.
The estimation of iteration is in the order of tens of th= ousands.

What is the best way of making using para= llel query strategy.

Any examples?

Can you provid= e some sample ddl, data and sql to illustrate your question?=C2=A0

You mention in one place "i= teration" and "parallel" but in another you mention recursio= n.. Recursion (by definition?) involves pushing state data forward into eac= h successive iteration.. Therefore you can't run recursion in parallel.= =C2=A0

If you can provid= e examples maybe we can see which if parallelism is a possibility..=C2=A0

Steve=C2=A0
--0000000000000c213105dc4ef75f--