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 1kDAjk-0005Sn-GR for pgsql-docs@arkaria.postgresql.org; Tue, 01 Sep 2020 18:10:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kDAjj-0005av-C9 for pgsql-docs@arkaria.postgresql.org; Tue, 01 Sep 2020 18:10:27 +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 1kDAjj-0005an-6B for pgsql-docs@lists.postgresql.org; Tue, 01 Sep 2020 18:10:27 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDAjc-00004r-Fk for pgsql-docs@lists.postgresql.org; Tue, 01 Sep 2020 18:10:26 +0000 Received: from bruce by momjian.us with local (Exim 4.92) (envelope-from ) id 1kDAja-0007v3-TJ; Tue, 01 Sep 2020 14:10:18 -0400 Date: Tue, 1 Sep 2020 14:10:18 -0400 From: Bruce Momjian To: yigongh@gmail.com, pgsql-docs@lists.postgresql.org Subject: Re: Adding description about the random_page_cost and parallel_leader_participation Message-ID: <20200901181018.GZ13613@momjian.us> References: <159898121004.3375.8319924957147010903@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <159898121004.3375.8319924957147010903@wrigleys.postgresql.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Sep 1, 2020 at 05:26:50PM +0000, PG Doc comments form wrote: > The following documentation comment has been logged on the website: > > Page: https://www.postgresql.org/docs/12/runtime-config-query.html > Description: > > I recently have an observation that the combination of random_page_cost and > parallel_leader_participation can cause a performance regression. However, > based on the official website, it seems that these two configurations seem > not to have a very straight relationship. > I run the PostgreSQL 11 on Ubuntu 18.04. When I create a database with > about 16MB and run a select query by pgbench. If I set the random_page_cost > as 4 and parallel_leader_participation is on, the average latency of select > query is about 72 ms for five clients. However, if we change the > random_page_cost to 1 or turn off the parallel_leader_participation, the > average latency is only 54ms. However, If I manually run the query on a > client, changing the value of random_page_cost doesn't change the > performance > I check the workload and find that if the random_page_cost is 4 and > parallel_leader_participation is on, query planer would tend to choose Merge > gather join for select clause, which would require more memory to do > sorting. If the random_page_cost is 1 and parallel_leader_participation is > on, the query plan would choose nest loop, which requires less memory. I > guess this might be the root cause of performance regression. > If my guess is true, I would suggest mentioning that the combination of > random_page_cost and paraller_leader_participation would cause the query to > use more memory in the official document There are a lot of interactions between settings, and mentioning all of them would be impossible. I suggest you ask this on our performance email list, and then you can get some ideas on the caues of this. -- Bruce Momjian https://momjian.us EnterpriseDB https://enterprisedb.com The usefulness of a cup is in its emptiness, Bruce Lee