From: | 高增琦 <pgf00a(at)gmail(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | why do we need create tuplestore for each fetch? |
Date: | 2011-12-15 13:30:56 |
Message-ID: | CAFmBtr0f3LnfRSuKzHV2JqxGwR-ADcnOMLr0LPxFZKyPQSjG-w@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi everyone,
I found this several days ago when I try to debug a "fetch" of cursor.
And I have sent a mail to this list, but no one reply...
Maybe this is a very simple problem, please help me, thanks a lot...
Here is the example:
create table t (a int);
insert into t values (1),(3),(5),(7),(9);
insert into t select a+1 from t;
begin;
declare c cursor for select * from t order by a;
fetch 3 in c;
fetch 3 in c;
fetch 3 in c;
In 'PortalRun', a fetch stmt will be treated with PORTAL_UTIL_SELECT,
and then a tuplestore will be created in 'FillPortalStore' in the
fetch stmt's portal.
In 'FillPortalStore', all result will be store at that tuplestore,
Then, go back to 'PortalRun'; next, 'PortalRunSelect' will send this
results to client...
My problem is: why do we need create that tuplestore as an
middle storeage? why do not we just send these result to clent
at the first time?
Thank you very much.
--
GaoZengqi
pgf00a(at)gmail(dot)com
zengqigao(at)gmail(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-12-15 13:37:59 | Re: patch : Allow toast tables to be moved to a different tablespace |
Previous Message | Simon Riggs | 2011-12-15 13:19:25 | Re: Race condition in HEAD, possibly due to PGPROC splitup |