pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: David Rowley <david.rowley@2ndquadrant.com>
Cc: Bartosz Polnik <bartoszpolnik@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #15577: Query returns different results when executed multiple times
Date: Wed, 09 Jan 2019 22:29:45 -0500
Message-ID: <5725.1547090985@sss.pgh.pa.us> (raw )
In-Reply-To: <CA+TgmoZEeHpKYdbksgDXTpE2o=AXOfX08NudPcz_fHYiu84gUg@mail.gmail.com >
References: <15577-ca61ab18904af852@postgresql.org >
<CAKJS1f8kLijpf-EKHLL7yJ2KJy9-FWNQfXBuNtToVTPkW_Ue+w@mail.gmail.com >
<CAM37Zev2xUezKc0XZFPfi=BtH+of+fqTAYUCJJuf+4Pc6u4G7g@mail.gmail.com >
<CAEepm=0yv2qNDM_JfiakqQO3EqYNhQZjNCAX=fK8Cuhz6_RO4Q@mail.gmail.com >
<CAM37ZetJ-R5De+aTfZV8+BE_KzqbajF3gjv_t1DGsS853aDc0Q@mail.gmail.com >
<CAEepm=15_MWhhp-Pg6rW1whuXrBTJ-gM=w+2t-Qk-VQHgniG0w@mail.gmail.com >
<CAM37ZevSHt0pdKhZ_Bu7nDoMMWSDsJaaPUPR_ApowoFida4fcA@mail.gmail.com >
<CAEepm=1QU7HpJSGhBkfFwKC_wW6fCTADeHymA7ngzszJRM39bw@mail.gmail.com >
<CAM37Zeu1gv=PswA-C4WeCN13KrrXcD9s1mTdaTuVTKjV=aLoiA@mail.gmail.com >
<CAEepm=34FwV5W3qoz29_bS1uodKkN1wS-P_9V429JUjjGKwopg@mail.gmail.com >
<CAM37ZeuWGV_58O8MeH0TfqBiK0JUONPhHs2=YM2MR61K2E=v9Q@mail.gmail.com >
<CAKJS1f8OZteLVbmKyoTuC7wY=fzZ+jW=gFV=0NoXS0AvfbOZ2g@mail.gmail.com >
<CAEepm=2MYvOvsA7YY-9kU0JT-2Bn51N-YjGq1mDi4GOeR=0nJA@mail.gmail.com >
<CAEepm=3s70u7-E9aSdsSq+_S_cm2GnT4Tk3_vC81PDxe=hCFRw@mail.gmail.com >
<CAEepm=3q=22Stv6QTR+ijWorWYMFRPC=T=hM9i! JPMxgpTOE55A@mail.gmail.com >
<CAM37Zeshup0OkzJ2z=8_jBPrv-=dQZvs+v0HDmKnFf4wLn7jzQ@mail.gmail.com >
<CAEepm=0eviDVN2n=Dr7FegnJ69w3Z+EaB=CBV5Y9HXLN_HwXKQ@mail.gmail.com >
<CAEepm=2UuWkK-tUZMK=SqJ8Qn3jX0jTpE=wk5KKSSJB0gYzSXQ@mail.gmail.com >
<CAKJS1f8zFL8539hpy_gBV3JOcNRqhb1wVVhuVkp_H_E_qJU_iw@mail.gmail.com >
<CAEepm=0ZqJp2nXRZf8e9ys6Utyu96QVy0=L8Q=-2UoDxwY=smA@mail.gmail.com >
<18883.1547071723@sss.pgh.pa.us >
<CA+TgmoZEeHpKYdbksgDXTpE2o=AXOfX08NudPcz_fHYiu84gUg@mail.gmail.com >
Robert Haas <robertmhaas@gmail.com> writes:
> On Wed, Jan 9, 2019 at 5:08 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> One way we could deal with this, perhaps, is to decide that NestLoopParams
>> above and below a Gather can't share PARAM_EXEC slots. I'm not sure how
>> we'd mechanize that, other than not allowing NestLoopParams to share
>> PARAM_EXEC slots *ever*, which might not really be that much of a cost.
>>
>> But TBH the whole thing frightens me quite a lot as to what other
>> serial-processing assumptions are getting broken by plopping Gather
>> into the middle of a plan tree. I wonder whether we'd not be best
>> off disallowing this sort of plan shape, and/or forbidding the leader
>> from also executing the parallelized subplan.
> FWIW, I would be inclined to blame this on me not really understanding
> the Param machinery very well rather than any more general brand of
> insanity. I wouldn't be a bit shocked if this is not the last bit
> Param-related dumbness than parallel query has. I did *try* to get it
> right, but I find that stuff to be pretty arcane and not entirely
> well-documented.
Well, if we posit that the problems are limited to false Param-sharing,
my inclination is to fix it by simplifying rather than adding complexity.
To wit, let's just assign a new PARAM_EXEC slot for every NestLoopParam
and never try to share them. The argument that sharing them would work
for NLPs representing the same Var hinged on the assumption that nested
NestLoops would necessarily execute "in sync", which we now see is false
at least when Gathers are in between.
This'll cost some more PARAM_EXEC slots, of course, but AFAICS the
cost of that is trivial, just a few more bytes per slot. It's arguable
that the cost of trying to de-duplicate them at plan time is more than
we can save at execution :-(
I'm about fried for tonight, but I can take a look at this tomorrow.
regards, tom lane
view thread (37+ messages) latest in thread
Message-ID: <5725.1547090985@sss.pgh.pa.us>
Permalink: ../5725.1547090985@sss.pgh.pa.us/
Also on: postgresql.org/message-id/5725.1547090985@sss.pgh.pa.us
copy link · copy postgr.es
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-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, robertmhaas@gmail.com, thomas.munro@enterprisedb.com, david.rowley@2ndquadrant.com, bartoszpolnik@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15577: Query returns different results when executed multiple times
In-Reply-To: <5725.1547090985@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