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 1ieP9I-0007XZ-3p for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 19:56:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieP9G-0006hr-Rf for pgsql-hackers@arkaria.postgresql.org; Mon, 09 Dec 2019 19:56:50 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieP9G-0006hj-IS for pgsql-hackers@lists.postgresql.org; Mon, 09 Dec 2019 19:56:50 +0000 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ieP9D-0006Vu-V3 for pgsql-hackers@postgresql.org; Mon, 09 Dec 2019 19:56:49 +0000 Received: by mail-pf1-x42d.google.com with SMTP id d199so7755638pfd.11 for ; Mon, 09 Dec 2019 11:56:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=MaQHG/y+1syT52pWnzk5n9kNDtkkdc4/VlG8uRKSkA4=; b=tv7wAdu+jJ0BUT/sRfxSKVkVNOlqb6wMZcCEL47QJaEeQ9G3Z4OBgyTWoWjEs0lcoN 6nTgfpaGEKiHW5gD1cLOVoMrg/8ssax+6FGecNnNCJima7BMuaRzpTzxGv1pqt+1Oun/ z7DZ2Ko/I0n0RxA4haWEEjETM4VNLYCuF1YOoMZTncZ3sTgsdu1o7QM9HIzhRnymJGk5 2wdkJ3IzqH3tL7KlAtVG6xwcIQwyLY8LgeN1P2opw1UwYGZ+zGRlX+PS34OqffcdpOpI 1EKoFCwS29snSLO5BXFLNXliI1lmDZ8DgI/f0hn9Z2SeLm1CPBvxHAcuGxOpHzsM5m6G c5Vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=MaQHG/y+1syT52pWnzk5n9kNDtkkdc4/VlG8uRKSkA4=; b=fJXFECpeCWCXMSLp3rMe7JKImOgLsAPNzBWpohyxpkLP6lxF2YNVzKLH7oOVIyLFqP CQXS3k7MkXtj9gUItJhG5G6MVdLl7nHkwL0gNGOrb4c221j4FEgIagHbaRFofsxdR47c eCWqlrTqjBlByH0U7+M1TlnANneulX3YP/Il5s4LwYgUXXfFzY/uaWkDFNeXrhYs0YCz eCT78PDbE1L/AOJOGlff75cAQiGXzwXXzVkjPD3eSubk7RYxOtF8dXEwoXFsN9fIA7Wh lZ7nvs78gE3AFEuuANbiS5yeJZ/Cwl1dvbKE2Kwut94kpOIPnLjP5lChD+tg1ZUUpz+U p4yA== X-Gm-Message-State: APjAAAUVMaHXpnmXap8eKmlKfTOVQCNTWeafhcnHi5ivyRNIxFhsBr0V J41bH+vOBdCpMlUqDWZsQLOVZ5Uj X-Google-Smtp-Source: APXvYqx/QUtbjqaTzGnDOYXUYvL0A10qlX6qbe/skdKCONfgaRcPrR0qS5hdNIbTnu8J3wgSg2B6gQ== X-Received: by 2002:a63:e17:: with SMTP id d23mr20670687pgl.173.1575921405879; Mon, 09 Dec 2019 11:56:45 -0800 (PST) Received: from [192.168.0.17] (24-113-193-150.wavecable.com. [24.113.193.150]) by smtp.gmail.com with ESMTPSA id 9sm279301pfx.177.2019.12.09.11.56.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Dec 2019 11:56:45 -0800 (PST) Subject: Re: Using multiple extended statistics for estimates To: Tomas Vondra Cc: PostgreSQL Hackers References: <0da76f1f-5f9c-3ce3-3ac6-042d2a18430a@gmail.com> <20191110173428.w5klequcmb6gawaa@development> <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> From: Mark Dilger Message-ID: <1cf520f8-8953-0f16-4794-c9a001e3e436@gmail.com> Date: Mon, 9 Dec 2019 11:56:39 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20191205175145.vlqw6c6h2ztiimy2@development> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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. I'll go mark this "ready for committer". -- Mark Dilger