Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZKj7f-0002hn-Vc for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jul 2015 08:23:28 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZKj7f-00077S-CS for pgsql-hackers@arkaria.postgresql.org; Thu, 30 Jul 2015 08:23:27 +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) (envelope-from ) id 1ZKj6N-0005bW-3j for pgsql-hackers@postgresql.org; Thu, 30 Jul 2015 08:22:07 +0000 Received: from mail-wi0-x22b.google.com ([2a00:1450:400c:c05::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZKj6J-0001KC-Mh for pgsql-hackers@postgresql.org; Thu, 30 Jul 2015 08:22:05 +0000 Received: by wicmv11 with SMTP id mv11so11043605wic.0 for ; Thu, 30 Jul 2015 01:22:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=tdZOkrY32Z4olAXZJQsCDWwnmaGl2pfpsM6cbL+7rkk=; b=yp+TyQkfiHK4sKnmQm1Wn/ZOPR9eLtaB5vgPOjeL4y2GleDRrkwkIs+sx7baMK5OmB +9xhcZBAkTnlWD+GRaTAnhgqJNmPUXRpBDyIeqYB0u6W/NIOpgSM/9ROA9ZP7SIgO5wF qG7+dNsjfOtarI2liLgdaIXBxZdd/2o3cYsr4eQDDOIWeBNPJvoxtpJ9DhipMnW+jMe/ qs9jTUBuRL/VGz8BOeOOkL0QyU1ZGpwMynYmcOGnkigBFnE3o131QDFSn7sfT9bdbjtq xuYS18v5U5ShIYQLv8juH/slpbsnaq/wffeFI7kWYW77wD35mKziHs/zuTBzlxz7oK+l +bvg== X-Received: by 10.194.133.73 with SMTP id pa9mr84898833wjb.148.1438244521757; Thu, 30 Jul 2015 01:22:01 -0700 (PDT) Received: from [192.168.1.105] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id lm5sm1682766wic.22.2015.07.30.01.22.00 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 30 Jul 2015 01:22:00 -0700 (PDT) Message-ID: <55B9DEA6.6030603@iki.fi> Date: Thu, 30 Jul 2015 11:21:58 +0300 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Tomas Vondra , pgsql-hackers CC: Jeff Janes , Stephen Frost , Kyotaro HORIGUCHI Subject: Re: multivariate statistics / patch v7 References: <54C3FED3.1060600@2ndquadrant.com> <20150320.173307.249113775.horiguchi.kyotaro@lab.ntt.co.jp> <550C8E50.2010600@2ndquadrant.com> <20150324.143427.34552953.horiguchi.kyotaro@lab.ntt.co.jp> <5519E9B2.5080105@2ndquadrant.com> <20150428161310.GR30322@tamriel.snowman.net> <553FCE56.2000008@2ndquadrant.com> <554A73A6.2060603@2ndquadrant.com> <55638982.40904@2ndquadrant.com> In-Reply-To: <55638982.40904@2ndquadrant.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) 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 On 05/25/2015 11:43 PM, Tomas Vondra wrote: > There are 6 files attached, but only 0002-0006 are actually part of the > multivariate statistics patch itself. All of these patches are huge. In order to review this in a reasonable amount of time, we need to do this in several steps. So let's see what would be the minimal set of these patches that could be reviewed and committed, while still being useful. The main patches are: 1. shared infrastructure and functional dependencies 2. clause reduction using functional dependencies 3. multivariate MCV lists 4. multivariate histograms 5. multi-statistics estimation Would it make sense to commit only patches 1 and 2 first? Would that be enough to get a benefit from this? I have some doubts about the clause reduction and functional dependencies part of this. It seems to treat functional dependency as a boolean property, but even with the classic zipcode and city case, it's not always an all or nothing thing. At least in some countries, there can be zipcodes that span multiple cities. So zipcode=X does not completely imply city=Y, although there is a strong correlation (if that's the right term). How strong does the correlation need to be for this patch to decide that zipcode implies city? I couldn't actually see a clear threshold stated anywhere. So rather than treating functional dependence as a boolean, I think it would make more sense to put a 0.0-1.0 number to it. That means that you can't do clause reduction like it's done in this patch, where you actually remove clauses from the query for cost esimation purposes. Instead, you need to calculate the selectivity for each clause independently, but instead of just multiplying the selectivities together, apply the "dependence factor" to it. Does that make sense? I haven't really looked at the MCV, histogram and "multi-statistics estimation" patches yet. Do those patches make the clause reduction patch obsolete? Should we forget about the clause reduction and functional dependency patch, and focus on those later patches instead? - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers