Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0, parser/executor stuff

From: Andres Freund <andres(at)anarazel(dot)de>
To: Peter Geoghegan <pg(at)heroku(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: hlinnaka <hlinnaka(at)iki(dot)fi>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Stephen Frost <sfrost(at)snowman(dot)net>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0, parser/executor stuff
Date: 2015-04-27 21:52:58
Message-ID: 20150427215258.GE7296@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

On 2015-04-27 16:28:49 +0200, Andres Freund wrote:
> On 2015-04-26 18:02:06 -0700, Peter Geoghegan wrote:
> > * So far, there has been a lack of scrutiny about what the patch does
> > in the rewriter (in particular, to support the EXCLUDED.* pseudo-alias
> > expression) and optimizer (the whole concept of an "auxiliary"
> > query/plan that share a target RTE, and later target ResultRelation).
> > If someone took a close look at that, it would be most helpful.
> > ruleutils.c is also modified for the benefit of EXPLAIN output. This
> > all applies only to the ON CONFLICT UPDATE patch. A committer could
> > push out the IGNORE patch before this was 100% firm.
>
> I'm far from an expert on the relevant regions; but I'm starting to look
> nonetheless. I have to say that on a preliminary look it looks more
> complicated than it has to.

So, I'm looking. And I've a few questions:
* Why do we need to spread knowledge about speculative inserts that wide?
It's now in 1) Query, 2) ParseState 3) ModifyTable 4) InsertStmt. That
seems a bit wide - and as far as I see not really necessary. That e.g.
transformUpdateStmt() has if (!pstate->p_is_speculative) blocks seems
wrong.

* afaics 'auxiliary query' isn't something we have under that
name. This isn't really different to what wCTEs do, so I don't think
we need this term here.

* You refer to 'join like syntax' in a couple places. I don't really see
the current syntax being that join like? Is that just a different
perception of terminology or is that just remnants of earlier
approaches?

* I am rather unconvinced we need the whole 'ExcludedVar' mechanism. I
don't really see why we need it at all? Can't we 'just' make those
plain vars referring to the normal targetlist "entry"? I feel like I'm
missing something here.

* The whole dealing with the update clause doesn't seem super
clean. I'm not sure yet how to do it nicer though :(

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Peter Geoghegan 2015-04-27 22:28:43 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0, parser/executor stuff
Previous Message Andres Freund 2015-04-27 14:28:49 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0, parser/executor stuff

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2015-04-27 22:28:43 Re: INSERT ... ON CONFLICT UPDATE/IGNORE 4.0, parser/executor stuff
Previous Message Jim Nasby 2015-04-27 21:21:36 Re: Feedback on getting rid of VACUUM FULL