Re: SQL functions, INSERT/UPDATE/DELETE RETURNING, and triggers

From: "Jim C(dot) Nasby" <jim(at)nasby(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: SQL functions, INSERT/UPDATE/DELETE RETURNING, and triggers
Date: 2006-10-12 19:00:12
Message-ID: 20061012190012.GQ28647@nasby.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 12, 2006 at 02:50:34PM -0400, Tom Lane wrote:
> > ISTM that pushing to a tuplestore is a lot of extra work for
>
> I'm not entirely convinced of that --- the overhead of getting down
> through functions.c and ExecutorRun into the per-tuple loop isn't
> trivial either. It wouldn't work at all without significant
> restructuring, in fact, because as execMain stands we'd be firing "per
> statement" triggers once per row if we tried to handle RETURNING queries
> the same way that SQL functions currently handle SELECTs. When you look
> at the big picture there's a whole lot of call overhead that would go
> away if SQL functions returned a tuplestore instead of a row at a time.
> I was toying with the idea that we should make SELECTs return via a
> tuplestore too, which would allow eliminating the special case of having
> ExecutorRun return an individual tuple at all. That's not a bugfix
> though so I'll wait for 8.3 before thinking more about it ...

The specific concern I have is large result sets, like 10s or 100s of MB
(or more). We just added support for not buffering those in psql, so it
seems like a step backwards to have the backend now buffering it (unless
I'm confused on how a tuplestore works...)
--
Jim Nasby jim(at)nasby(dot)net
EnterpriseDB http://enterprisedb.com 512.569.9461 (cell)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-10-12 19:00:13 Re: SQL functions, INSERT/UPDATE/DELETE RETURNING, and triggers
Previous Message Jim C. Nasby 2006-10-12 18:56:37 Re: On status data and summaries