Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw2E4-0000LP-Fs for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 07:53:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cw2E4-0006TZ-35 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 07:53:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cw2CZ-0003Mm-Bp for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 07:51:31 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by magus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw2CU-0003oA-TG for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 07:51:30 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id v367pLkZ021927; Thu, 6 Apr 2017 16:51:21 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 6D9095F63F; Thu, 6 Apr 2017 16:51:21 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id 5F7F55F594; Thu, 6 Apr 2017 16:51:21 +0900 (JST) Received: from localhost (unknown [129.60.241.55]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id 4B8EE40037B; Thu, 6 Apr 2017 16:51:21 +0900 (JST) Date: Thu, 06 Apr 2017 16:50:56 +0900 (Tokyo Standard Time) Message-Id: <20170406.165056.135052192.horiguchi.kyotaro@lab.ntt.co.jp> Subject: Re: [COMMITTERS] pgsql: Collect and use multi-column dependency stats From: Kyotaro HORIGUCHI In-Reply-To: References: <20170406.150316.128378012.horiguchi.kyotaro@lab.ntt.co.jp> User-Agent: Mew version 6.5 on Emacs 22.2 / Mule 5.0 =?iso-2022-jp?B?KBskQjpnGyhCKQ==?= / Meadow-3.01-dev (TSUBO-SUMIRE) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: david.rowley@2ndquadrant.com Cc: tgl@sss.pgh.pa.us, simon@2ndquadrant.com, pgsql-hackers@postgresql.org X-TM-AS-MML: disable X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org At Thu, 6 Apr 2017 18:59:35 +1200, David Rowley wrote in > On 6 April 2017 at 18:03, Kyotaro HORIGUCHI > wrote: > > At Thu, 6 Apr 2017 13:10:48 +1200, David Rowley wrote in > >> On 6 April 2017 at 13:05, David Rowley wrote: > I'm not all that sure why the number of columns in the relation has > relevance to the performance of find_relation_from_clauses(). The > bms_get_singleton_member() is checking which relations are part of the > RestrictInfo, nothing related to columns in relations. > Perhaps you meant clauses in the clauses list? Which does not really > have all that much to do with the number of columns in the relation > either. Sorry, it's number of relations, not columns. I'm not sure up to how many relations we practically should consider but anyway it is extra burden to every call to clauselist_selectivity. We should avoid calling find_relation_from_clauses as far as possible or do the same in more simple way. However I'm not sure more precise exclusion is possible or not, I thinks that the case of jointype != JOIN_INNER can be exluded. > > At Thu, 6 Apr 2017 13:05:24 +1200, David Rowley wrote in > >> > And you measured the overhead of doing it the other way to be ... ? > >> > Premature optimization and all that. > >> > >> I tested with the attached, and it does not seem to hurt planner > >> performance executing: > > > > Here, bms_singleton_member takes longer time if the relation has > > many columns and there's a functional dependency covering the > > columns at the very tail. Maybe only two are not practical for > > testing. > > Can you explain why you think this? And confirm you're speaking about > the bms_get_singleton() member in find_relation_from_clauses() I mentioned dependency_is_compatible_clause here, but I saw that it has been simplified enough in the committed shape. > > Even if it doesn't impact performance detectably, if only one > > attribute is needed, an AttrNumber member in context will be > > sufficient. No bitmap operation seems required in > > dependency_compatible_walker and it can bail out by the second > > attribute. > > Are you looking at an old patch? That function no longer exists. Yes! Sorry for the noise. regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers