Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cw4sV-000072-Jw for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 10:42:59 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1cw4sV-00024V-63 for pgsql-hackers@arkaria.postgresql.org; Thu, 06 Apr 2017 10:42:59 +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 1cw4sU-00023V-3J for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 10:42:58 +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 1cw4sP-0003zP-T7 for pgsql-hackers@postgresql.org; Thu, 06 Apr 2017 10:42:56 +0000 Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id v36AgpDQ026180; Thu, 6 Apr 2017 19:42:51 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id E625C5F65A; Thu, 6 Apr 2017 19:42:50 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id D9B555F590; Thu, 6 Apr 2017 19:42:50 +0900 (JST) Received: from localhost (unknown [129.60.241.55]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id CE160400355; Thu, 6 Apr 2017 19:42:50 +0900 (JST) Date: Thu, 06 Apr 2017 19:42:24 +0900 (Tokyo Standard Time) Message-Id: <20170406.194224.249381919.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.165056.135052192.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 21:55:43 +1200, David Rowley wrote in > On 6 April 2017 at 19:50, Kyotaro HORIGUCHI > wrote: > > 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. > > Well, I imagine queries with >= 32 relations are not planning very > quickly as of today already. I understand what you mean when you speak > of attributes, as we could constantly be looking for the 1400's > attribute which is many loops into a bms_get_singleton_member() call. > I can't imagine we'll even flow over the first word in a bitmap set in > 99% of cases with clause_relids. In any case, even if there's a giant > chain of clauses in the the 'clauses' list, we'll bail out on the > first join qual anyway, since it won't be a singleton clause_relid. Yes, I agree that most cases doesn't suffer this. Anyway since I don't have enough knowlege required to roughly estimate the impact nor concrete expample where the planning time increases significantly, I don't assert any more on this point. > I'd say if you can come up with a test case where you can measure the > impact of this, then let's discuss more. Otherwise we're stepping back > into the territory that Tom warned me about a few emails up.... > Premature Optimisation. I'm not walking down there again, I only just > got back. 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