Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPSvl-0004pO-2m for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Mar 2022 17:38:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nPSvk-0001fG-0s for pgsql-hackers@arkaria.postgresql.org; Wed, 02 Mar 2022 17:38:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nPSvj-0001f2-KQ for pgsql-hackers@lists.postgresql.org; Wed, 02 Mar 2022 17:38:27 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nPSvg-00025u-9q for pgsql-hackers@postgresql.org; Wed, 02 Mar 2022 17:38:26 +0000 Received: by mail-il1-x12a.google.com with SMTP id i1so1982414ila.7 for ; Wed, 02 Mar 2022 09:38:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=gO2yW7cNtOfsqARm47PpXjA8122XParnfCBTs3+pae4=; b=oK+cS/bIdvrt0CbU711eInIOBNiEFWSYDn0Ah3YBOXNpRMkBhCkiFIqx42SxWFQVck AucpNGOhgK3pIbo/Up4bR/Dqwg8KaxEx/q74zF7b4urIccS6UeynU+H/ixyVO6bceDur H/E4bBVBPuXkgonpryih88JSaCz0P07YX5xYmz/kE/NVi6TT7T/IxaHNfyTPDmo8N6pA mtDoKS7OyCCYFRlgu6vaqgK3iu3DYD7z+b1DZ6uhzjOdSnZ5WMg0D3KXwRHAvn2iZk41 GcSfvf5d3Ibtrehb+ztxCQkyYxZr3b9TOL+KUQ53QanTglZRfvHkQrhXLjjatrpoa8gc fhgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=gO2yW7cNtOfsqARm47PpXjA8122XParnfCBTs3+pae4=; b=oYe6zldWzI7pIZGOX27XFk7R6Ce0yvG951d80zBjGqFZfgKRXem/Jb177L6TwB0TTO v5lqXRRby+kNFfhLyBUU2SFTnUcYPWHtVUxCCemP/+UHD2p8Cz2cJNSxm8wz3VfehqXd NbhRYaypyADQo8cqBis9UsBiCLV+YiTHpYEmGpfBytY3UqGmeMEBVtrMIL61TNOeQHth eE7+nYx4VwDbyFFf6fOVZC3se0dbUMe6UXVwgwI8/Zpc3Gxhmlw4URgtgm5wuFTRgBjk RZn6dz2OwBlh3jnj/9HAD+NYVcfmtp9yvaXMGiE1+4mJeKZnDeBgIuHdDJi9w0T1rJ0R FMqg== X-Gm-Message-State: AOAM53186PuT3Zbr535amqMqzkUGDgkAKagftuHRUJudFUezGfn4vfTV 0rz0hgqc1N25vQyEctMLClj2tg== X-Google-Smtp-Source: ABdhPJzVsF1iQlLiOPcsmsWMOVYbENqL7Ch3vYCOfxNKIoGxCPf4WlRX2V0Oz9w22DpTZomIPqRgJA== X-Received: by 2002:a05:6e02:1c49:b0:2c1:ec10:70af with SMTP id d9-20020a056e021c4900b002c1ec1070afmr28594667ilg.184.1646242703336; Wed, 02 Mar 2022 09:38:23 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id k11-20020a926f0b000000b002c2756f7e90sm9449484ilc.17.2022.03.02.09.38.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Mar 2022 09:38:22 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id C51DC800E60; Wed, 2 Mar 2022 11:38:21 -0600 (CST) Date: Wed, 2 Mar 2022 11:38:21 -0600 From: Justin Pryzby To: Julien Rouhaud Cc: Andres Freund , Tomas Vondra , pgsql-hackers@postgresql.org Subject: Re: using extended statistics to improve join estimates Message-ID: <20220302173821.GG15744@telsasoft.com> References: <2ed75657-e084-9539-c6de-597e5675014c@enterprisedb.com> <20211122012315.GH17618@telsasoft.com> <0213d237-efd5-8e7e-fa29-3f36e6e26023@enterprisedb.com> <1ea3bf2b-57f9-e632-251a-e718623d7a72@enterprisedb.com> <20220104235550.dgr4rz6zkjx2rykz@alap3.anarazel.de> <20220119101809.wzrjvh4jsnoakgny@jrouhaud> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220119101809.wzrjvh4jsnoakgny@jrouhaud> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jan 19, 2022 at 06:18:09PM +0800, Julien Rouhaud wrote: > On Tue, Jan 04, 2022 at 03:55:50PM -0800, Andres Freund wrote: > > On 2022-01-01 18:21:06 +0100, Tomas Vondra wrote: > > > Here's an updated patch, rebased and fixing a couple typos reported by > > > Justin Pryzby directly. > > > > FWIW, cfbot reports a few compiler warnings: > > Also the patch doesn't apply anymore: > > http://cfbot.cputube.org/patch_36_3055.log > === Applying patches on top of PostgreSQL commit ID 74527c3e022d3ace648340b79a6ddec3419f6732 === > === applying patch ./0001-Estimate-joins-using-extended-statistics-20220101.patch > patching file src/backend/optimizer/path/clausesel.c > patching file src/backend/statistics/extended_stats.c > Hunk #1 FAILED at 30. > Hunk #2 succeeded at 102 (offset 1 line). > Hunk #3 succeeded at 2619 (offset 9 lines). > 1 out of 3 hunks FAILED -- saving rejects to file src/backend/statistics/extended_stats.c.rej Rebased over 269b532ae and muted compiler warnings. Tomas - is this patch viable for pg15 , or should move to the next CF ? In case it's useful, I ran this on cirrus with my branch for code coverage. https://cirrus-ci.com/task/5816731397521408 https://api.cirrus-ci.com/v1/artifact/task/5816731397521408/coverage/coverage/00-index.html statext_find_matching_mcv() has poor coverage. statext_clauselist_join_selectivity() has poor coverage for the "stats2" case. In mcv.c: mcv_combine_extended() and mcv_combine_simple() have poor coverage for the "else if" cases (does it matter?) Not related to this patch: build_attnums_array() isn't being hit. Same at statext_is_compatible_clause_internal() 1538 0 : *exprs = lappend(*exprs, clause); statext_mcv_[de]serialize() aren't being hit for cstrings. -- Justin