Re: More efficient RI checks - take 2 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: More efficient RI checks - take 2
Date
Msg-id 28825.1588085098@sss.pgh.pa.us
Whole thread Raw
In response to Re: More efficient RI checks - take 2  (Stephen Frost <sfrost@snowman.net>)
Responses Re: More efficient RI checks - take 2  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
Stephen Frost <sfrost@snowman.net> writes:
> * Robert Haas (robertmhaas@gmail.com) wrote:
>> As you say, perhaps there's room for both things, but also as you say,
>> it's not obvious how to decide intelligently between them.

> The single-row case seems pretty clear and also seems common enough that
> it'd be worth paying the cost to figure out if it's a single-row
> statement or not.

That seems hard to do in advance ... but it would be easy to code
a statement-level AFTER trigger along the lines of

    if (transition table contains one row)
        // fast special case here
    else
        // slow general case here.

I think the question really comes down to this: is the per-row overhead of
the transition-table mechanism comparable to that of the AFTER trigger
queue?  Or if not, can we make it so?

            regards, tom lane



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Binary COPY IN size reduction
Next
From: Tomas Vondra
Date:
Subject: Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays