Refcursor

Started by Yambuabout 5 years ago2 messagesgeneral
Jump to latest
#1Yambu
hyambu@gmail.com

Hi

I new to cursors

May I know why the below takes so long?

BEGIN;
select * from func1() ;
fetch all from "<unnamed portal 1>";
end;

Select * from func1() ; on its own is very fast

#2Laurenz Albe
laurenz.albe@cybertec.at
In reply to: Yambu (#1)
Re: Refcursor

On Mon, 2021-03-15 at 13:58 +0200, Yambu wrote:

May I know why the below takes so long?

BEGIN;
select * from func1() ;
fetch all from "<unnamed portal 1>";
end;

Select * from func1() ; on its own is very fast

The second just fetches a cursor for the query, the
first executes the query. Executing the query is what
can take long.

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com