Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aZ9eO-00017U-As for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Feb 2016 04:05:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aZ9eN-0004E2-EC for pgsql-hackers@arkaria.postgresql.org; Fri, 26 Feb 2016 04:05:07 +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) (envelope-from ) id 1aZ9d3-0002iH-AJ for pgsql-hackers@postgresql.org; Fri, 26 Feb 2016 04:03:45 +0000 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1aZ9cz-0000hX-NF for pgsql-hackers@postgresql.org; Fri, 26 Feb 2016 04:03:44 +0000 Received: by mail-wm0-x22b.google.com with SMTP id g62so56182992wme.1 for ; Thu, 25 Feb 2016 20:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=ETzKR7yD6ziVkUizoCEZR39aL19YzT4m9Tw+6WW+VTA=; b=Z749fZ/2PblcxRf0zjUh4tnhxEZHQhaXcp30YOPw88p/dN/Ybp9oOY4auHj5wk2HyI 78E3M1k2QRxHBrhW4+0gBuxSyUzny3FVeHNk7Egf4YHyc6RAwsHIBgQG0LABUGp71PAu 5SHnnzDXONcESmb+1u7ASKAKm5+J6e+Y2FTvZqPStWYSzafJuZj6QyCB1UwM5keCCe28 I0GupxToJUluP5mGYF976jxHUYpLkP/Is5B8+0o7vdbQMcBEW/vshJEy49W+eeylOdl+ GgcBB6ou7Zd3hlEmUZO40CwTdg+RpP2O5cn3nAiB3pvJvcxfevSf7qmc3cka3Cgjoiou B2Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=ETzKR7yD6ziVkUizoCEZR39aL19YzT4m9Tw+6WW+VTA=; b=c//MulunX9cqAF1Dz8ryxwhv3fJ1/S1Xbodf67pFmI+PFIBqDzEbgTK5VPCfWXgTUz g4f3HWK2tUPUl9hpQMw88H4eKdFas+rfaXX5ZPkiboG8nLlPrZKvUEROwQQWmdJJb1ZW w9LhtGoOsqaOOL065+xnrSJ3eRDkl6/85NraHTWnh8D4cUiva7ZIll00Sv49/lzQvV0j rtyJRWseOMRobTmR4hkzn6oL5mKMB/zgN7pnWTc5V9bb0GWb0GeKs+2wR7J8BJwy2G+b sFRaEtj55eMXgYzswZytLOwWXc8mD9n7H4O7YdB36WjDabVU5f+pI2W6jYb8fjkj4JY9 MhVw== X-Gm-Message-State: AG10YOQaD9ZNm/iYNZ9PIe1/rDPPW+5WMhj6wTBhWGctCyZ1pBr/afyolBu2YABW7f0/CvQh45dBA5x/fwoDY/HuyInASRHSloScvXoH0Ds8Pl/OuJ3O6NFlqmsF5WZ7h952i6eE5h1QCUnhcFf73LG2TzaTSkdbxfHIaaeePrpt+eQbI9hZ2759AVd7I+uZ5ADnxF4kwm8H X-Received: by 10.194.24.193 with SMTP id w1mr47765467wjf.33.1456459419382; Thu, 25 Feb 2016 20:03:39 -0800 (PST) Received: from [10.137.1.13] (ip-78-45-216-26.net.upcbroadband.cz. [78.45.216.26]) by smtp.gmail.com with ESMTPSA id j18sm1094202wmd.2.2016.02.25.20.03.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Feb 2016 20:03:38 -0800 (PST) Subject: Re: improving GROUP BY estimation To: Mark Dilger References: <56CD0381.5060502@2ndquadrant.com> <03A3B58D-6A2D-44FE-9B03-E21948CFCBAA@gmail.com> <56CFA373.3060105@2ndquadrant.com> <7D1A65E8-7ED8-4268-9C24-8EA07E95D2BC@gmail.com> Cc: PostgreSQL-development From: Tomas Vondra Message-ID: <56CFCE96.5080306@2ndquadrant.com> Date: Fri, 26 Feb 2016 05:03:34 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <7D1A65E8-7ED8-4268-9C24-8EA07E95D2BC@gmail.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) 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 Hi, On 02/26/2016 04:32 AM, Mark Dilger wrote: > >> On Feb 25, 2016, at 4:59 PM, Tomas Vondra wrote: >> ... >> >> The culprit here is that the two columns are not independent, but >> are (rather strongly) correlated due to the way you've generated >> the data. > > Yes, that was intentional. Your formula is exactly correct, so far as > i can tell, for completely uncorrelated data. I don't have any tables > with completely uncorrelated data, and was therefore interested in > what happens when the data is correlated and your patch is applied. > > BTW, the whole reason I responded to your post is that I think I would like > to have your changes in the code base. I'm just playing Devil's Advocate > here, to see if there is room for any improvement. Sure, that's how I understood it. I just wanted to point out the correlation, as that might not have been obvious to others. > Thanks for the patch submission. I hope my effort to review it is on > the whole more helpful than harmful. Thanks for the feedback! regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers