Hi!
I am wondering if there is any difference between adding LIMIT and OFFSET in plpgsql function body and function call.
CREATE FUNCTION test ()
RETURNS record AS
$body$
DECLARE
BEGIN
select * from producent order by id limit 5 offset 10;
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER;
CREATE FUNCTION test1 ()
RETURNS record AS
$body$
DECLARE
BEGIN
select * from producent order by id;
END;
$body$
LANGUAGE 'plpgsql'
VOLATILE
CALLED ON NULL INPUT
SECURITY INVOKER;
Which will by faster:
select * from test();
or
select * from test1() limit 5 offset 10;