pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Antonin Houska <ah@cybertec.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Corey Huinker <corey.huinker@gmail.com>
Cc: Pavel Stehule <pavel.stehule@gmail.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: More efficient RI checks - take 2
Date: Thu, 23 Apr 2020 07:08:02 +0200
Message-ID: <28826.1587618482@antos> (raw)
In-Reply-To: <6442.1587595207@sss.pgh.pa.us>
References: <20200422154231.6shz4kdor4yb5w5b@alap3.anarazel.de>
	<20200422171806.GA12435@alvherre.pgsql>
	<CA+TgmoZF_fkSYTcY7=yiRr7MxC=yt1VoZPMcYfwsRYw6TusEmA@mail.gmail.com>
	<20200422183600.tpl5745dfbnozi6t@alap3.anarazel.de>
	<CA+Tgmobb2_sm8PZ16_dqevUktcjT8OnZ5xvv=AFtxWWjf28VxA@mail.gmail.com>
	<6442.1587595207@sss.pgh.pa.us>

Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Robert Haas <robertmhaas@gmail.com> writes:
> > Right -- the idea I was talking about was to create a Plan tree
> > without using the main planner. So it wouldn't bother costing an index
> > scan on each index, and a sequential scan, on the target table - it
> > would just make an index scan plan, or maybe an index path that it
> > would then convert to an index plan. Or something like that.
> 
> Consing up a Path tree and then letting create_plan() make it into
> an executable plan might not be a terrible idea.  There's a whole
> boatload of finicky details that you could avoid that way, like
> everything in setrefs.c.
> 
> But it's not entirely clear to me that we know the best plan for a
> statement-level RI action with sufficient certainty to go that way.
> Is it really the case that the plan would not vary based on how
> many tuples there are to check, for example?

I'm concerned about that too. With my patch the checks become a bit slower if
only a single row is processed. The problem seems to be that the planner is
not entirely convinced about that the number of input rows, so it can still
build a plan that expects many rows. For example (as I mentioned elsewhere in
the thread), a hash join where the hash table only contains one tuple. Or
similarly a sort node for a single input tuple.

-- 
Antonin Houska
Web: https://www.cybertec-postgresql.com





view thread (35+ messages)  latest in thread

Message-ID: <28826.1587618482@antos>
Permalink:  ../28826.1587618482@antos/
Also on:    postgresql.org/message-id/28826.1587618482@antos

 · 

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-hackers@postgresql.org
  Cc: ah@cybertec.at, tgl@sss.pgh.pa.us, robertmhaas@gmail.com, andres@anarazel.de, alvherre@2ndquadrant.com, corey.huinker@gmail.com, pavel.stehule@gmail.com
  Subject: Re: More efficient RI checks - take 2
  In-Reply-To: <28826.1587618482@antos>

* 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