pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Cc: Alan Jackson <ajax@tvsquared.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: inconsistent results querying table partitioned by date
Date: Sat, 18 May 2019 10:58:11 -0400
Message-ID: <20739.1558191491@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKJS1f-fcpjSK=dnsVsXdC-1ZBVCE23Z=Mbev9Go0W27-dAONg@mail.gmail.com>
References: <FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com>
	<CAKJS1f92Uq+SV+WKKa+B5Fd9PcrwhYFsvxUudm_9F8egi4paXQ@mail.gmail.com>
	<d7878f1f-f7c5-4f23-127e-ced79a64ddf1@lab.ntt.co.jp>
	<CAKJS1f-xHgnr0QVfGtt9BU38kB8a5fp4Y=CYbChV8xSqw6pZ9w@mail.gmail.com>
	<e903adfc-c7a5-58f9-6b7f-16ab6f48be5c@lab.ntt.co.jp>
	<28453.1557867500@sss.pgh.pa.us>
	<CAKJS1f82n-WNsu6G5WNXGFV4MsnosydiouRvTNnZYmQz0tciuQ@mail.gmail.com>
	<588f56cb-aaed-14b0-8a21-13486bd1c706@lab.ntt.co.jp>
	<CAKJS1f-QVbr-9-m+=b6mxWxaJYzdK554uptnNyV5M6AhkUMcdg@mail.gmail.com>
	<CAKJS1f-ABcw68AH7tRRRmBTEwhd-Y_Lm8HpfydWw6aPS8G715A@mail.gmail.com>
	<10502.1557941878@sss.pgh.pa.us>
	<CAKJS1f9QP2tDczHDFk=55Jh-wS+bCUWTuBd0uiqg5dfpz6r44g@mail.gmail.com>
	<23372.1557966530@sss.pgh.pa.us>
	<CAKJS1f_wn4qiQfi0Bnfc6uA3rm=ususVyixF8yGFUTjdaY6omg@mail.gmail.com>
	<14871.1558022797@sss.pgh.pa.us>
	<12600.1558034735@sss.pgh.pa.us>
	<7099.1558047050@sss.pgh.pa.us>
	<d5ba9f1c-218b-2d76-1fbf-878252ac9d57@lab.ntt.co.jp>
	<14101.1558128611@sss.pgh.pa.us>
	<CAKJS1f-fcpjSK=dnsVsXdC-1ZBVCE23Z=Mbev9Go0W27-dAONg@mail.gmail.com>

David Rowley <david.rowley@2ndquadrant.com> writes:
> Thanks for working on this.  I did have a look and was a bit
> disappointed to see the code will end up calling pull_exec_paramids()
> 3 times for any expression with exec param IDs. I can knock that down
> to just 2 by caching the exec Param IDs of the used quals in
> GeneratePruningStepsContext. I imagine you didn't do this since its
> possible we reject the qual even after has_exec_param is set,

Exactly.

> but if
> we just delay recording the param IDs until after we're certain we're
> using the qual then it should be safe to do this.

I thought about that too, but it seems awfully messy/fragile; it's not
clear to me at what point this code is really guaranteed to have accepted
a clause.  The recursion for AND/OR, in particular, seems to make that
kind of questionable.

If we could be sure about that I'd be inclined to apply the principle
to the has_mutable_arg and has_exec_param flags as well as exec_paramids,
and change the order of tests in match_clause_to_partition_key back to
what it was, relying on the outer control layer to not propagate that
data into the overall state until we knew whether the clause was really
going to contribute to the steps.

			regards, tom lane





view thread (41+ messages)  latest in thread

Message-ID: <20739.1558191491@sss.pgh.pa.us>
Permalink:  ../20739.1558191491@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20739.1558191491@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, Langote_Amit_f8@lab.ntt.co.jp, horiguchi.kyotaro@lab.ntt.co.jp, ajax@tvsquared.com
  Subject: Re: inconsistent results querying table partitioned by date
  In-Reply-To: <20739.1558191491@sss.pgh.pa.us>
  References: <FAD28A83-AC73-489E-A058-2681FA31D648@tvsquared.com> <CAKJS1f-xHgnr0QVfGtt9BU38kB8a5fp4Y=CYbChV8xSqw6pZ9w@mail.gmail.com> <e903adfc-c7a5-58f9-6b7f-16ab6f48be5c@lab.ntt.co.jp> <28453.1557867500@sss.pgh.pa.us> <CAKJS1f82n-WNsu6G5WNXGFV4MsnosydiouRvTNnZYmQz0tciuQ@mail.gmail.com> <588f56cb-aaed-14b0-8a21-13486bd1c706@lab.ntt.co.jp> <CAKJS1f-QVbr-9-m+=b6mxWxaJYzdK554uptnNyV5M6AhkUMcdg@mail.gmail.com> <CAKJS1f-ABcw68AH7tRRRmBTEwhd-Y_Lm8HpfydWw6aPS8G715A@mail.gmail.com> <10502.1557941878@sss.pgh.pa.us> <CAKJS1f9QP2tDczHDFk=55Jh-wS+bCUWTuBd0uiqg5dfpz6r44g@mail.gmail.com> <23372.1557966530@sss.pgh.pa.us> <CAKJS1f_wn4qiQfi0Bnfc6uA3rm=ususVyixF8yGFUTjdaY6omg@mail.gmail.com> <14871.1558022797@sss.pgh.pa.us> <12600.1558034735@sss.pgh.pa.us> <7099.1558047050@sss.pgh.pa.us> <d5ba9f1c-218b-2d76-1fbf-878252ac9d57@lab.ntt.co.jp> <14101.1558128611@sss.pgh.pa.us> <CAKJS1f-fcpjSK=dnsVsXdC-1ZBVCE23Z=Mbev9Go0W27-dAONg@mail.gmail.com> <20739.1558191491@sss.pgh.pa.us>

* 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