Re: C function accepting/returning cstring vs. text

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: C function accepting/returning cstring vs. text
Date: 2010-01-27 15:34:10
Message-ID: 4B605CF2.9030900@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Ivan Sergio Borgonovo wrote:
> On Wed, 27 Jan 2010 10:10:01 -0500
> Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
>
>
>> There are quite a few SRF functions in the code. Look for example
>> in contrib/hstore/hstore_op.c for some fairly simple examples.
>> SRFs are quite capable of returning huge resultsets, not just
>> small ones. Example code for matrerialize mode can be found in the
>> PLs among other places (e.g. plperl_return_next() )
>>
>
> I'm more interested in understanding when I should use materialized
> mode.
> eg. I should be more concerned about memory or cpu cycles and what
> should be taken as a reference to consider memory needs "large"?
> If for example I was going to split a large TEXT into a set of
> record (let's say I'm processing csv that has been loaded into a
> text field)... I'd consider the CPU use "light" but the memory needs
> "large". Would be this task suited for the materialized mode?
>
> Is there a rule of thumb to chose between one mode or the other?
>
>
>

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.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2010-01-27 15:37:23 Re: C function accepting/returning cstring vs. text
Previous Message Ivan Sergio Borgonovo 2010-01-27 15:28:24 Re: C function accepting/returning cstring vs. text