From: | Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it> |
---|---|
To: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: C function accepting/returning cstring vs. text |
Date: | 2010-01-27 17:49:47 |
Message-ID: | 20100127184947.70838a16@dawn.webthatworks.it |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 27 Jan 2010 17:37:23 +0200
Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> wrote:
> Currently, there's no difference in terms of memory needs. The
> backend always materializes the result of a SRF into a tuplestore
> anyway, if the function didn't do it itself. There has been
> discussion of optimizing away that materialization step, but
> no-one has come up with an acceptable patch for that yet.
> There probably isn't much difference in CPU usage either.
On Wed, 27 Jan 2010 10:34:10 -0500
Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> If you don't know your memory use will be light, use materialized
> mode. For small results the data will still be in memory anyway.
> The Tuplestore will only spill to disk if it grows beyond a
> certain size.
I keep on missing something.
Considering all the context switching stuff, the "first call"
initialization etc... I'd expect that what's collecting the result
was going to push it downstream a bit at a time.
What's actually happening is... the result get collected anyway in a
Tuplestore.
But then... why do we have all that logic to save the function
context if anyway it is more convenient to process everything in one
run?
It's a pain to save the context just to save a pointer inside a
structure, it would be more convenient to just process all the
structure and return it as a Tuplestore in one pass.
BTW thanks to Greg for pointing me once more to Joe Conway's
tutorial. When I read it the first time I wasn't in a condition to
take advantage of it. Now it looks more useful.
--
Ivan Sergio Borgonovo
http://www.webthatworks.it
From | Date | Subject | |
---|---|---|---|
Next Message | David E. Wheeler | 2010-01-27 17:53:44 | Re: Add on_perl_init and proper destruction to plperl [PATCH] |
Previous Message | David Fetter | 2010-01-27 17:42:48 | Re: [COMMITTERS] pgsql: Remove tabs in SGML. |