mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Add COST and ROWS options to CREATE/ALTER FUNCTION, plus underlying pg_proc
columns procost and prorows, to allow simple user adjustment of the estimated cost of a function call, as well as control of the estimated number of rows returned by a set-returning function. We might eventually wish to extend this to allow function-specific estimation routines, but there seems to be consensus that we should try a simple constant estimate first. In particular this provides a relatively simple way to control the order in which different WHERE clauses are applied in a plan node, which is a Good Thing in view of the fact that the recent EquivalenceClass planner rewrite made that much less predictable than before.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.84 2007/01/05 22:19:25 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_aggregate.c,v 1.85 2007/01/22 01:35:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -214,7 +214,9 @@ AggregateCreate(const char *aggName,
|
||||
numArgs), /* paramTypes */
|
||||
PointerGetDatum(NULL), /* allParamTypes */
|
||||
PointerGetDatum(NULL), /* parameterModes */
|
||||
PointerGetDatum(NULL)); /* parameterNames */
|
||||
PointerGetDatum(NULL), /* parameterNames */
|
||||
1, /* procost */
|
||||
0); /* prorows */
|
||||
|
||||
/*
|
||||
* Okay to create the pg_aggregate entry.
|
||||
|
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.142 2007/01/05 22:19:25 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.143 2007/01/22 01:35:20 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -71,7 +71,9 @@ ProcedureCreate(const char *procedureName,
|
||||
oidvector *parameterTypes,
|
||||
Datum allParameterTypes,
|
||||
Datum parameterModes,
|
||||
Datum parameterNames)
|
||||
Datum parameterNames,
|
||||
float4 procost,
|
||||
float4 prorows)
|
||||
{
|
||||
Oid retval;
|
||||
int parameterCount;
|
||||
@@ -219,6 +221,8 @@ ProcedureCreate(const char *procedureName,
|
||||
values[Anum_pg_proc_pronamespace - 1] = ObjectIdGetDatum(procNamespace);
|
||||
values[Anum_pg_proc_proowner - 1] = ObjectIdGetDatum(GetUserId());
|
||||
values[Anum_pg_proc_prolang - 1] = ObjectIdGetDatum(languageObjectId);
|
||||
values[Anum_pg_proc_procost - 1] = Float4GetDatum(procost);
|
||||
values[Anum_pg_proc_prorows - 1] = Float4GetDatum(prorows);
|
||||
values[Anum_pg_proc_proisagg - 1] = BoolGetDatum(isAgg);
|
||||
values[Anum_pg_proc_prosecdef - 1] = BoolGetDatum(security_definer);
|
||||
values[Anum_pg_proc_proisstrict - 1] = BoolGetDatum(isStrict);
|
||||
|
Reference in New Issue
Block a user