pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tomas Vondra <tomas.vondra@2ndquadrant.com>
To: Dean Rasheed <dean.a.rasheed@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Mark Dilger <hornschnorter@gmail.com>
Cc: Adrien Nayrat <adrien.nayrat@dalibo.com>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
Date: Tue, 27 Mar 2018 19:34:26 +0200
Message-ID: <1aaa338a-fa70-1b92-988e-498eb996ce57@2ndquadrant.com> (raw)
In-Reply-To: <CAEZATCUOyMMpyrUKFV15_Eaaxgxg3oxSL_ChA9EVm0MaA_eXcw@mail.gmail.com>
References: <20180310171906.gd6vyz6hnou2n3h7@alvherre.pgsql>
	<850c3b6b-2641-496c-4efc-500c720f7260@2ndquadrant.com>
	<ec49a434-b814-2cfa-f602-02a0cc9e518c@2ndquadrant.com>
	<CAEZATCW9AXzf+1T44B0=rBd8a0AD+pWO_PpkhApqLBE9JS1Cyg@mail.gmail.com>
	<66ba9c45-3b07-e5b6-fd11-15e75f6ee8e1@2ndquadrant.com>
	<CAEZATCUC8h6Osegq2Lw75Hc1NG=72JgNiiTQSSp9CpDCkQgakw@mail.gmail.com>
	<49348328-1a02-7e45-e50f-e1d4d0243c5c@2ndquadrant.com>
	<CAEZATCUk5rfLxm60W0VYT8zF2trFRRBonJKTwF46s+hjr28Fyw@mail.gmail.com>
	<CAEZATCUOyMMpyrUKFV15_Eaaxgxg3oxSL_ChA9EVm0MaA_eXcw@mail.gmail.com>

On 03/27/2018 07:03 PM, Dean Rasheed wrote:
> On 27 March 2018 at 14:58, Dean Rasheed <dean.a.rasheed@gmail.com> wrote:
>> On 27 March 2018 at 01:36, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>>> 4) handling of NOT clauses in MCV lists (and in histograms)
>>>
>>> The query you posted does not fail anymore...
>>>
>> Ah, it turns out the previous query wasn't actually failing for the
>> reason I thought it was -- it was failing because it had a
>> ScalarArrayOpExpr that was being passed to
>> mcv_clauselist_selectivity() because of the wrong list being passed to
>> it. I could see from the code that a NOT clause would have tripped it
>> up, but most NOT clauses actually get rewritten by negate_clause() so
>> they end up not being NOT clauses.
>>
> 
> Thinking about that some, I think that the only NOT clauses this needs
> to actually worry about are NOTs of boolean Vars. Anything else that
> this code supports will have been transformed into something other
> than a NOT before reaching this point. Thus it might be much simpler
> to handle that as a special case in statext_is_compatible_clause() and
> mcv_update_match_bitmap(), rather than trying to support general NOT
> clauses, and going through a recursive call to
> mcv_update_match_bitmap(), and then having to merge bitmaps. NOT of a
> boolean Var could then be treated just like var=false, setting the
> appropriate attribute match entry if it's found in the MCV list. This
> would allow clauses like (a=1 and NOT b) to be supported, which I
> don't think currently works, because fullmatch won't get set.
> 

Yes, I came to the same conclusion ;-) I'll send an updated patch later
today.

regards

-- 
Tomas Vondra                  http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services




view thread (167+ messages)  latest in thread

Message-ID: <1aaa338a-fa70-1b92-988e-498eb996ce57@2ndquadrant.com>
Permalink:  ../1aaa338a-fa70-1b92-988e-498eb996ce57@2ndquadrant.com/
Also on:    postgresql.org/message-id/1aaa338a-fa70-1b92-988e-498eb996ce57@2ndquadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, dean.a.rasheed@gmail.com, alvherre@2ndquadrant.com, andres@anarazel.de, thomas.munro@enterprisedb.com, hornschnorter@gmail.com, adrien.nayrat@dalibo.com
  Subject: Re: [HACKERS] PATCH: multivariate histograms and MCV lists
  In-Reply-To: <1aaa338a-fa70-1b92-988e-498eb996ce57@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox