why do we need create tuplestore for each fetch? - Mailing list pgsql-hackers

From 高增琦
Subject why do we need create tuplestore for each fetch?
Date
Msg-id CAFmBtr0f3LnfRSuKzHV2JqxGwR-ADcnOMLr0LPxFZKyPQSjG-w@mail.gmail.com
Whole thread Raw
Responses Re: why do we need create tuplestore for each fetch?
List pgsql-hackers
Hi everyone,<br /><br />I found this several days ago when I try to debug a "fetch" of cursor. <br />And I have sent a
mailto this list, but no one reply...<br />Maybe this is a very simple problem, please help me, thanks a lot...<br
/><br/>Here is the example:<br />    create table t (a int);<br />    insert into t values (1),(3),(5),(7),(9);<br
/>   insert into t select a+1 from t;<br />    begin;<br />    declare c cursor for select * from t order by a;<br
/>   fetch 3 in c;<br />     fetch 3 in c;<br />    fetch 3 in c;<br />    <br />In 'PortalRun', a fetch stmt will be
treatedwith PORTAL_UTIL_SELECT,<br />and then a tuplestore will be created in 'FillPortalStore' in the<br />fetch
stmt'sportal.<br /><br />In 'FillPortalStore', all result will be store at that tuplestore,<br />Then, go back to
'PortalRun';next,  'PortalRunSelect' will send this<br />results to client...<br /><br />My problem is: why do we need
createthat tuplestore as an<br /> middle storeage? why do not we just send these result to clent<br />at the first
time?<br/><br />Thank you very much.<br clear="all" /><br />-- <br />GaoZengqi<br /><a href="mailto:pgf00a@gmail.com"
target="_blank">pgf00a@gmail.com</a><br/><a href="mailto:zengqigao@gmail.com"
target="_blank">zengqigao@gmail.com</a><br/> 

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Race condition in HEAD, possibly due to PGPROC splitup
Next
From: Alvaro Herrera
Date:
Subject: Re: patch : Allow toast tables to be moved to a different tablespace