cost variable into function

Started by Alain Rogerover 17 years ago3 messagesgeneral
Jump to latest
#1Alain Roger
raf.news@gmail.com

Hi,

i created a stored procedure (function) under postgreSQL and when i checked
deeper into my DB, this is what i get:
....
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION myschema.get_count_languages(character varying) OWNER TO
myuser;

to what corresponds the parameter COST 100 ?
it is the first time i see that :-(
thx.
--
Alain
------------------------------------
Windows XP SP3
PostgreSQL 8.2.4 / MS SQL server 2005
Apache 2.2.4
PHP 5.2.4
C# 2005-2008

#2Grzegorz Jaśkiewicz
gryzman@gmail.com
In reply to: Alain Roger (#1)
Re: cost variable into function

that's for planner to know. You can estimate cost in there, of that
procedure. I usually use select * from something limit 1 times number of
rows that procedure returns on average. But I am sure, some more smart
people here would have different ways to set it.

In reply to: Alain Roger (#1)
Re: cost variable into function

On Sun, Oct 19, 2008 at 04:03:47PM +0200, Alain Roger wrote:

i created a stored procedure (function) under postgreSQL and when i checked
deeper into my DB, this is what i get:
....
END;
$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION myschema.get_count_languages(character varying) OWNER TO
myuser;
to what corresponds the parameter COST 100 ?

check the explanation here:
http://www.postgresql.org/docs/current/interactive/sql-createfunction.html

Best regards,

depesz

--
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007