public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andrew Dunstan <[email protected]>
To: David Fetter <[email protected]>
Cc: PostgreSQL Patches <[email protected]>
Cc: PostgreSQL Docs <[email protected]>
Cc: Bruce Momjian <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Michael Fuhr <[email protected]>
Cc: [email protected]
Subject: Re: [HACKERS] PL/Perl list value return causes segfault
Date: Sat, 30 Jul 2005 09:47:58 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>
	<[email protected]>



David Fetter wrote:

>*** 716,724 ****
>  
>      <listitem>
>       <para>
>!       In the current implementation, if you are fetching or returning
>!       very large data sets, you should be aware that these will all go
>!       into memory.
>       </para>
>      </listitem>
>     </itemizedlist>
>--- 766,776 ----
>  
>      <listitem>
>       <para>
>!       If you are fetching or returning very large data sets using
>!       <literal>spi_exec_query</literal>, you should be aware that
>!       these will all go into memory.  You can avoid this by using
>!       <literal>spi_query</literal>/<literal>spi_fetchrow</literal> as
>!       illustrated earlier.
>       </para>
>      </listitem>
>     </itemizedlist>
>  
>
>  
>

You have rolled 2 problems into one - spi_query+spi_fetchrow does not 
address the issue of returning large data sets.

Suggest instead:

<para>

       If you are fetching very large data sets using
       <literal>spi_exec_query</literal>, you should be aware that
       these will all go into memory.  You can avoid this by using
       <literal>spi_query</literal> and <literal>spi_fetchrow</literal> 
	as illustrated earlier.
</para>
<para>
	A similar problem occurs if a set-returning function passes 
	a large set of rows back to postgres via 
	<literal>return</literal>. You can avoid this 
	problem too by instead using <literal>return_next</literal> for 
	each row returned, as shown previously.
</para>




cheers

andrew



view thread (13+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: [HACKERS] PL/Perl list value return causes segfault
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox