Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieR4u-0004Gy-To for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 22:00:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieR4s-00010x-JS for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 22:00:26 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieR4s-00010q-7K for pgsql-hackers@lists.postgresql.org; Mon, 09 Dec 2019 22:00:26 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ieR4o-0001cK-U6 for pgsql-hackers@postgresql.org; Mon, 09 Dec 2019 22:00:25 +0000 Received: by mail-wm1-x343.google.com with SMTP id f4so864649wmj.1 for ; Mon, 09 Dec 2019 14:00:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FODZKSoSamJGnRvLid5GmKQ2h1zLXGWIiFy2Xv704/0=; b=FYEdQW1VFVxkr1kPq83I5lM8t1Z/JMzQka20gtQWb9nMe+JB/xHQ5Tr9zJ9nkvaBsZ Dkpf4B0j2NHe3ebaR6oDZb2HShZ88CDIXLQfLTaxvn1pIoLWK8XC+cMO3PIq3j87zl+d FlARRPXkVxe91WtMr6tTtqWd12VJ1xWc+f1idr1O8DY3ILIOce5Bq2B/BbOq9Rhr0sYU QXb75cBB1tF+ezL+NB47Qt+NiG1Nafl2jpXki/rvG0LEau8c7X8cVuP7poQTMbIhi0cW EjyPOEkqJ24MDNfwbjsXjbTscQYdIsRmlY+8kk3L/R6LPvc969ZWPWhB/8y/peL2rF8g j+eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FODZKSoSamJGnRvLid5GmKQ2h1zLXGWIiFy2Xv704/0=; b=OYJaNqJ8KRbGdeTX6q1ZWL9ltMv2I3lpkqffRMW0NmvJmvxVQR84ReZpyA1dPbiMZ+ aSiavJhodKZ2u+hcQPaTvOHt/6asCHEp///IeRcF940WEr0+pbT5vLHHrH6MuO7BKsQA 7HcQ1FfemzuAdXZpqI4vxZBPwvGWmsFf1C1F9a3MsjXZyJjWiw9FetXpg7WafDKpM3U/ UypPFItGxZs7dOGaOa/AiPI3xlHmR/DKqxpzbi3gQaSbE3cuJtx+K+JW3dbqJ1ixO9Af +Mwjv305VTc4lWw30koYPCA7HSnpm88ZpHJ3J4muIA+hslbNKKRJzOywTBFfpXTTZtuQ bHTw== X-Gm-Message-State: APjAAAX9z8O9Ak3rlwzccX+DTxaq10UA91YjKRHl+efOnUOrBzsTHbvT n69BsTKp/dOim0LmaQgaI+0Iqg== X-Google-Smtp-Source: APXvYqy2BtrONmaLDTdu9W5lYUq9HEfi8Kn1NysbJtJY07k1sbYc32PH/Bu4AHnc+aaZNa610J8DRg== X-Received: by 2002:a7b:c38c:: with SMTP id s12mr1286872wmj.96.1575928820790; Mon, 09 Dec 2019 14:00:20 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id n129sm824598wmb.1.2019.12.09.14.00.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Dec 2019 14:00:18 -0800 (PST) Date: Mon, 9 Dec 2019 23:00:17 +0100 From: Tomas Vondra To: Mark Dilger Cc: PostgreSQL Hackers Subject: Re: Using multiple extended statistics for estimates Message-ID: <20191209220017.6eidna5ai7z2wdf5@development> References: <20191113152823.jdpertc73gfo2mk7@development> <2e183f8d-1304-6024-90de-1017a861a235@gmail.com> <20191114155541.zliellgi2if4bb5f@development> <20191114200420.c3x2jf7ywzs23uzo@development> <20191201190858.oielyi5rpfg5mc23@development> <20191205171554.leclyueirbwun7dp@development> <20191205175145.vlqw6c6h2ztiimy2@development> <1cf520f8-8953-0f16-4794-c9a001e3e436@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <1cf520f8-8953-0f16-4794-c9a001e3e436@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Dec 09, 2019 at 11:56:39AM -0800, Mark Dilger wrote: > > >On 12/5/19 9:51 AM, Tomas Vondra wrote: >>On Thu, Dec 05, 2019 at 06:15:54PM +0100, Tomas Vondra wrote: >>>On Sun, Dec 01, 2019 at 08:08:58PM +0100, Tomas Vondra wrote: >>>>On Sat, Nov 30, 2019 at 03:01:31PM -0800, Mark Dilger wrote: >>>>> >>>>>Are you planning to submit a revised patch for this? >>>>> >>>> >>>>Yes, I'll submit a rebased version of this patch shortly. I got broken >>>>because of the recent fix in choose_best_statistics, shouldn't take long >>>>to update the patch. I do have a couple more related patches in the >>>>queue, so I want to submit them all at once. >>>> >>> >>>OK, here we go - these two patched allow applying multiple extended >>>statistics, both for MCV and functional dependencies. Functional >>>dependencies are simply merged and then applied at once (so withouth >>>choose_best_statistics), statistics are considered in greedy manner by >>>calling choose_best_statistics in a loop. >>> >> >>OK, this time with the patches actually attached ;-) > >These look good to me. I added extra tests (not included in this email) >to verify the code on more interesting test cases, such as partitioned >tables and within joins. Your test cases are pretty trivial, just being >selects from a single table. > Adding such more complex tests seem like a good idea, maybe you'd like to share them? >I'll go mark this "ready for committer". > Thanks for the review. I'll hold-off with the commit until the next CF, though, just to give others a proper opportunity to look at it. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services