Re: return next

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: return next
Date: 2005-11-11 14:57:16
Message-ID: 18533.1131721036@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> From the docs on plperl:
> "Usually you'll want to return rows one at a time, both to speed up
> startup time and to keep from queueing up the entire result set in
> memory. You can do this with return_next as illustrated below."

> Am I misunderstanding the docs? How do I just return one tuple at a time
> without PostgreSQL continuing the loop?

The docs are perhaps a little misleading. The perl function will
execute to completion in any case --- it's hard to see how to prevent
that from happening without breaking perl. The point of the comment
is that with return_next, buffering of the result set happens in a
TupleStore object (which knows how to spill an oversize set to disk)
rather than inside perl (which doesn't).

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Schmidt 2005-11-11 15:14:18 Re: Two slightly different queries produce same results,
Previous Message Tom Lane 2005-11-11 14:40:25 Re: Best way to use indexes for partial match at