What is Cost 100 in stored procedure

Started by Yan Cheng Cheokabout 16 years ago2 messagesgeneral
Jump to latest
#1Yan Cheng Cheok
yccheok@yahoo.com

May I know what is the meaning of Cost 100, at the end of stored procedure?

....
END;$BODY$
LANGUAGE 'plpgsql' VOLATILE
COST 100;
ALTER FUNCTION create_tables() OWNER TO postgres;

Thanks and Regards
Yan Cheng CHEOK

#2Rob Wultsch
wultsch@gmail.com
In reply to: Yan Cheng Cheok (#1)
Re: What is Cost 100 in stored procedure

On Tue, Jan 12, 2010 at 8:06 PM, Yan Cheng Cheok <yccheok@yahoo.com> wrote:

May I know what is the meaning of Cost 100, at the end of stored procedure?

....
END;$BODY$
 LANGUAGE 'plpgsql' VOLATILE
 COST 100;
ALTER FUNCTION create_tables() OWNER TO postgres;

Thanks and Regards
Yan Cheng CHEOK

"execution_cost

A positive number giving the estimated execution cost for the
function, in units of cpu_operator_cost. If the function returns a
set, this is the cost per returned row. If the cost is not specified,
1 unit is assumed for C-language and internal functions, and 100 units
for functions in all other languages. Larger values cause the planner
to try to avoid evaluating the function more often than necessary. "

http://www.postgresql.org/docs/8.4/interactive/sql-createfunction.html

--
Rob Wultsch
wultsch@gmail.com