Re: [HACKERS] why do we need create tuplestore for each fetch?

2011-12-20 Thread 高增琦
Thanks for you reply. I found query without cursor is faster then query with server-side cursor and several fetches. But I have a large result set to retrieve from database. I have to choose server-side cursor to avoid out-of-memory problem. When I try to debug the cursor and fetch, I found this

Re: [HACKERS] why do we need create tuplestore for each fetch?

2011-12-20 Thread Tom Lane
=?UTF-8?B?6auY5aKe55Cm?= pgf...@gmail.com writes: 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

Re: [HACKERS] why do we need create tuplestore for each fetch?

2011-12-19 Thread Robert Haas
On Thu, Dec 15, 2011 at 8:30 AM, 高增琦 pgf...@gmail.com wrote: 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

[HACKERS] why do we need create tuplestore for each fetch?

2011-12-15 Thread 高增琦
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