When I assign a variable with
result := title || '', by '' || author;
it is taking more time (approx. 15 sec) to run the function.
However, when I assign the variable with
result = title || '', by '' || author;
it takes only 133ms.
Why is it taking more time for the first scenario? And what is the reason behind this?
Full function is given below.
CREATE OR REPLACE FUNCTION myschema.fn_get_res_no(reservation_no character varying)
RETURNS character varying AS
$BODY$
DECLARE
emd_status_firstcall varchar(2);
emd_status_secondcall varchar(2);
emd_status varchar(6);
BEGIN
SELECT firstwscomplete, secondwscomplete
INTO emd_status_firstcall, emd_status_secondcall
FROM myschema.mytable
WHERE respkgconfirmid = reservation_no;
emd_status = emd_status_firstcall || ', ' || emd_status_secondcall;
RETURN emd_status ;
END;
$BODY$
LANGUAGE plpgsql VOLATILE;
CREATE FUNCTION bla() RETURNS void AS $body$ ... $body$ LANGUAGE plpgsql;
then you wouldn't need doubled quotes in your code. Just an idea.