pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jim Finnerty <jfinnert@amazon.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Removing INNER JOINs
Date: Mon, 11 Dec 2017 10:04:37 -0500
Message-ID: <24892.1513004677@sss.pgh.pa.us> (raw)
In-Reply-To: <1512999483420-0.post@n3.nabble.com>
References: <VisenaEmail.2b.7dfa64bdab147c49.1600d1d9df0@tc7-visena>
	<CAKJS1f9FToa68cr_DETV=utG6xqokXYm+yQ=-PpVj9aPkGXanw@mail.gmail.com>
	<CANP8+jKTPQqiUEba6WZ4dd+ca=UrhbJ1BEUv080bs6Gy-tXKQQ@mail.gmail.com>
	<CAKJS1f-5UrL0R-z5TQnJ37YkgU9RwkDHW4NSkL+ZO3adUDLzQQ@mail.gmail.com>
	<1512966801439-0.post@n3.nabble.com>
	<CAKJS1f_bczvo=6zsh1FU6Ayj1FV9OT0gD_CMvxN1JNW9k+Eruw@mail.gmail.com>
	<1512999483420-0.post@n3.nabble.com>

Jim Finnerty <jfinnert@amazon.com> writes:
> Great example, David.  The planner can detect whether a SELECT statement
> contains a volatile function, and can disable the proposed redundant
> inner-join optimization in that case.  

> If necessary, the planner could also check that the FK constraint is not
> DEFERRED, but if there are no volatile functions and the SELECT statement
> can't see an inconsistent state created by any other transaction, I think
> that just checking for volatile functions and not being inside a DML
> transaction would be sufficient.

I don't think you're thinking nearly hard enough about what would break
this.  The planner does not have much insight into the context a
statement is being used in (e.g. whether we're inside some kind of
PL function).  Nor does it get to make assumptions about whether the plan
will be used inside a transaction block or not.

			regards, tom lane




view thread (10+ messages)  latest in thread

Message-ID: <24892.1513004677@sss.pgh.pa.us>
Permalink:  ../24892.1513004677@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/24892.1513004677@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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jfinnert@amazon.com
  Subject: Re: Removing INNER JOINs
  In-Reply-To: <24892.1513004677@sss.pgh.pa.us>
  References: <VisenaEmail.2b.7dfa64bdab147c49.1600d1d9df0@tc7-visena> <CAKJS1f9FToa68cr_DETV=utG6xqokXYm+yQ=-PpVj9aPkGXanw@mail.gmail.com> <CANP8+jKTPQqiUEba6WZ4dd+ca=UrhbJ1BEUv080bs6Gy-tXKQQ@mail.gmail.com> <CAKJS1f-5UrL0R-z5TQnJ37YkgU9RwkDHW4NSkL+ZO3adUDLzQQ@mail.gmail.com> <1512966801439-0.post@n3.nabble.com> <CAKJS1f_bczvo=6zsh1FU6Ayj1FV9OT0gD_CMvxN1JNW9k+Eruw@mail.gmail.com> <1512999483420-0.post@n3.nabble.com> <24892.1513004677@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