Re: Large data sets and FOR LOOP's - Mailing list pgsql-sql

From Jan Wieck
Subject Re: Large data sets and FOR LOOP's
Date
Msg-id 200203131629.g2DGTRp31887@saturn.janwieck.net
Whole thread Raw
In response to Large data sets and FOR LOOP's  (Bo Lorentsen <bl@netgroup.dk>)
Responses Re: Large data sets and FOR LOOP's  (Bo Lorentsen <bl@netgroup.dk>)
List pgsql-sql
Bo Lorentsen wrote:
> Hi ...
>
> I have been working on some server side scripts in Plpgsql and I'm quite
> happy about them (nice and fast way to work with large data sets) :-)
>
> But, if I, in my code, make "for loop" on a huge select result (about
> 1.7 mil. rows), my function begin to consume alot of memory. The code
> looks like this :
>
> FOR trec IN SELECT f1,f2 FROM large_tabel LOOP
>    ...
> END LOOP;
   You  probably  want to upgrade to 7.2, because 7.2's PL/pgSQL   uses the newly available SPI cursors silently in FOR
loops.
   Releases before 7.2 loaded the entire result set into  memory   (ahem, swap space) before entering the FOR loop.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com



pgsql-sql by date:

Previous
From: Jean-Christophe FABRE
Date:
Subject: how to know if you are granted on a table?
Next
From: Florian Weimer
Date:
Subject: Re: SELECT FOR UPDATE