pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: New design for FK-based join selectivity estimation
Date: Wed, 29 Jun 2016 15:34:25 -0400
Message-ID: <25869.1467228865@sss.pgh.pa.us> (raw)
In-Reply-To: <87poqzg6f7.fsf@news-spur.riddles.org.uk>
References: <31041.1465069446@sss.pgh.pa.us>
	<25469.1465138626@sss.pgh.pa.us>
	<b790983b-4503-66ff-30c0-e7f46e3ad2f7@2ndquadrant.com>
	<15245.1466031608@sss.pgh.pa.us>
	<87poqzg6f7.fsf@news-spur.riddles.org.uk>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

Andrew Gierth <andrew@tao11.riddles.org.uk> writes:
> If the query was produced by rule expansion then the code that populates
> fkinfo includes FK references to the OLD and NEW RTEs, but those might not
> appear in the jointree (the testcase for the bug is a DELETE rule where
> NEW clearly doesn't apply) and hence build_simple_rel was not called
> (causing find_base_rel to fail). Not sure what the right fix is.

Meh.  I had a vaguely uneasy feeling that just scanning the rtable was
too simplistic, but hadn't thought hard about it.

For a really correct fix we could search the jointree to see which rels
are in it, but that would add code and cycles.  A slightly cheating way to
do it is to not use find_base_rel() but look into the simple_rel_array for
ourselves, and do nothing if there's no rel corresponding to the RTE
index.

			regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



view thread (25+ messages)  latest in thread

Message-ID: <25869.1467228865@sss.pgh.pa.us>
Permalink:  ../25869.1467228865@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/25869.1467228865@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-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, andrew@tao11.riddles.org.uk, tomas.vondra@2ndquadrant.com
  Subject: Re: New design for FK-based join selectivity estimation
  In-Reply-To: <25869.1467228865@sss.pgh.pa.us>
  References: <31041.1465069446@sss.pgh.pa.us> <25469.1465138626@sss.pgh.pa.us> <b790983b-4503-66ff-30c0-e7f46e3ad2f7@2ndquadrant.com> <15245.1466031608@sss.pgh.pa.us> <87poqzg6f7.fsf@news-spur.riddles.org.uk> <25869.1467228865@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