Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw0Xq-0008QI-Ao for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 06:05:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cw0Xp-0002XJ-5w for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 06:05:21 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1cw0WL-0008GK-Lo for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 06:03:49 +0000 Received: from tama50.ecl.ntt.co.jp ([129.60.39.147]) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw0WH-0006yz-S1 for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 06:03:47 +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 v3663gaV019125; Thu, 6 Apr 2017 15:03:42 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id C43835F680; Thu, 6 Apr 2017 15:03:42 +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 B8BF45F63F; Thu, 6 Apr 2017 15:03:42 +0900 (JST) Received: from localhost (unknown [129.60.241.55]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id A5F8C40037B; Thu, 6 Apr 2017 15:03:42 +0900 (JST) Date: Thu, 06 Apr 2017 15:03:16 +0900 (Tokyo Standard Time) Message-Id: <20170406.150316.128378012.horiguchi.kyotaro@lab.ntt.co.jp> Subject: Re: [COMMITTERS] pgsql: Collect and use multi-column dependency stats From: Kyotaro HORIGUCHI In-Reply-To: References: <5801.1491435183@sss.pgh.pa.us> 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 13:10:48 +1200, David Rowley wrote in > On 6 April 2017 at 13:05, David Rowley wrote: > > I tested with the attached, and it does not seem to hurt planner > > performance executing: > > Here's it again, this time with a comment on the > find_relation_from_clauses() function. It seems to work as the same as the previous version with additional cost to scan over restrict clauses. But separate loop over clauses is additional overhead in any cases even irrelavant to functional dependency. The more columns are in the relation, the longer time bms_get_singleton_member takes. Although I'm not sure how much it hurts performance and I can't think of a good alternative right now, I think that the overhead should be avoided anyhow. 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. 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. 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