pg.ddx.io  pgsql-bugs@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: Daniel Gustafsson <daniel@yesql.se>
Cc: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Manuel Rigger <rigger.manuel@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: Failed assertion clauses != NIL
Date: Thu, 28 Nov 2019 22:40:30 +0100
Message-ID: <20191128214030.rhvbp4r2molt3z47@development> (raw)
In-Reply-To: <CAEZATCUrakUupEZd5fZ5zhdHR2kf6573Hjx8F1Eie0cStOOjNw@mail.gmail.com>
References: <20191119133839.5qj5zia4pkd3zldt@localhost>
	<520C6E76-53A5-4EF2-A855-8054582221A5@yesql.se>
	<20191119150840.nmezhsf2tpip7osh@development>
	<CAEZATCXXF82RXJzUZATPo3OsKn137ojxNSz83LgsxhDhzVmVjg@mail.gmail.com>
	<20191121145308.zzdcs5uozhtlmcos@development>
	<20191124234011.iq7wnq2gohdcsroj@development>
	<CAEZATCXccM8m8r=g+UhS3K9LUFNONVf8WvmWJwGcpJSJ-km-6A@mail.gmail.com>
	<20191126174131.p3zv5t2oeqkinx4d@development>
	<20191127003311.ppjl6nvw4b2nojdi@development>
	<CAEZATCUrakUupEZd5fZ5zhdHR2kf6573Hjx8F1Eie0cStOOjNw@mail.gmail.com>

On Wed, Nov 27, 2019 at 09:26:11AM +0000, Dean Rasheed wrote:
>On Wed, 27 Nov 2019 at 00:33, Tomas Vondra <tomas.vondra@2ndquadrant.com> wrote:
>>
>> >On Tue, Nov 26, 2019 at 10:56:33AM +0000, Dean Rasheed wrote:
>> >
>> >>In fact, on closer inspection, I don't think you need to pass it to
>> >>choose_best_statistics() at all, since its callers already check
>> >>clauses against estimatedClauses. Therefore, in
>> >>choose_best_statistics(), incompatible and already-estimated clauses
>> >>both appear the same (as NULL/empty attribute sets), and therefore the
>> >>estimatedClauses check will never be tripped.
>> >
>> >Right, but I'm thinking about the patch that allows applying multiple
>> >statistics. With that applied, this changes to a while loop - and we'll
>> >either have to rebuild the list_attnums or pass the bitmap.
>>
>> On second thought, that's not quite relevant in backbranches, so I've
>> removed the parameters for now. I'll add it in the patch that adds
>> support for multiple stats.
>>
>
>Or alternatively, that patch could just NULL-out the relevant
>list_attnums[] array entry once the corresponding clause has been
>estimated, which would avoid needing to change
>choose_best_statistics() again.
>
>> Attached is the 0001 part, addressing (hopefully) all the comments.
>>
>
>I just spotted a trivial comment typo in dependencies_clauselist_selectivity():
>
>+ /*
>+ * We expect the bitmaps ton contain a single attribute number.
>+ */
>+ attnum = bms_singleton_member(list_attnums[listidx]);
>
>s/ton/to/
>
>Also, in statext_mcv_clauselist_selectivity(), clauses_attnums is now
>unused, so there's no point in computing it (unless you wanted to add
>the Assert() you talked about, but I don't think it's really
>necessary).
>
>Otherwise it looks good to me.
>

I've pushed this, after adding a regression test for OR clauses that are
not fully covered by the MCV statistic. The existing regression queries
test almost exclusively AND clauses, so I've considered adding a couple
more, but then I reliazed the support for OR clauses is somewhat limited
so the patch improving support for OR clauses is a better opportunity.

And now that I look at Dean's message again, I realize I forgot to
remove the unnecessary clauses_attnum variable, so I'll fix that.

regards

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





view thread (13+ messages)

Message-ID: <20191128214030.rhvbp4r2molt3z47@development>
Permalink:  ../20191128214030.rhvbp4r2molt3z47@development/
Also on:    postgresql.org/message-id/20191128214030.rhvbp4r2molt3z47@development

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tomas.vondra@2ndquadrant.com, dean.a.rasheed@gmail.com, daniel@yesql.se, 9erthalion6@gmail.com, rigger.manuel@gmail.com
  Subject: Re: Failed assertion clauses != NIL
  In-Reply-To: <20191128214030.rhvbp4r2molt3z47@development>
  References: <20191119133839.5qj5zia4pkd3zldt@localhost> <520C6E76-53A5-4EF2-A855-8054582221A5@yesql.se> <20191119150840.nmezhsf2tpip7osh@development> <CAEZATCXXF82RXJzUZATPo3OsKn137ojxNSz83LgsxhDhzVmVjg@mail.gmail.com> <20191121145308.zzdcs5uozhtlmcos@development> <20191124234011.iq7wnq2gohdcsroj@development> <CAEZATCXccM8m8r=g+UhS3K9LUFNONVf8WvmWJwGcpJSJ-km-6A@mail.gmail.com> <20191126174131.p3zv5t2oeqkinx4d@development> <20191127003311.ppjl6nvw4b2nojdi@development> <CAEZATCUrakUupEZd5fZ5zhdHR2kf6573Hjx8F1Eie0cStOOjNw@mail.gmail.com> <20191128214030.rhvbp4r2molt3z47@development>

* 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