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