mirror of
https://github.com/postgres/postgres.git
synced 2025-05-17 00:03:56 -04:00
If we're going to expose VariableStatData for contrib modules to use,
then we should export a reasonable set of the supporting routines too.
This commit is contained in:
parent
f1b3d5b02d
commit
a3c1a11fc1
@ -15,7 +15,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.201 2006/04/26 22:32:56 momjian Exp $
|
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.202 2006/04/27 00:46:58 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -111,8 +111,6 @@
|
|||||||
#include "utils/syscache.h"
|
#include "utils/syscache.h"
|
||||||
|
|
||||||
|
|
||||||
static double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
|
|
||||||
Datum constval, double *sumcommonp);
|
|
||||||
static double ineq_histogram_selectivity(VariableStatData *vardata,
|
static double ineq_histogram_selectivity(VariableStatData *vardata,
|
||||||
FmgrInfo *opproc, bool isgt,
|
FmgrInfo *opproc, bool isgt,
|
||||||
Datum constval, Oid consttype);
|
Datum constval, Oid consttype);
|
||||||
@ -138,12 +136,6 @@ static double convert_one_bytea_to_scalar(unsigned char *value, int valuelen,
|
|||||||
int rangelo, int rangehi);
|
int rangelo, int rangehi);
|
||||||
static char *convert_string_datum(Datum value, Oid typid);
|
static char *convert_string_datum(Datum value, Oid typid);
|
||||||
static double convert_timevalue_to_scalar(Datum value, Oid typid);
|
static double convert_timevalue_to_scalar(Datum value, Oid typid);
|
||||||
static void get_join_variables(PlannerInfo *root, List *args,
|
|
||||||
VariableStatData *vardata1,
|
|
||||||
VariableStatData *vardata2);
|
|
||||||
static void examine_variable(PlannerInfo *root, Node *node, int varRelid,
|
|
||||||
VariableStatData *vardata);
|
|
||||||
static double get_variable_numdistinct(VariableStatData *vardata);
|
|
||||||
static bool get_variable_maximum(PlannerInfo *root, VariableStatData *vardata,
|
static bool get_variable_maximum(PlannerInfo *root, VariableStatData *vardata,
|
||||||
Oid sortop, Datum *max);
|
Oid sortop, Datum *max);
|
||||||
static Selectivity prefix_selectivity(VariableStatData *vardata,
|
static Selectivity prefix_selectivity(VariableStatData *vardata,
|
||||||
@ -476,7 +468,7 @@ scalarineqsel(PlannerInfo *root, Oid operator, bool isgt,
|
|||||||
* total population is returned into *sumcommonp. Zeroes are returned
|
* total population is returned into *sumcommonp. Zeroes are returned
|
||||||
* if there is no MCV list.
|
* if there is no MCV list.
|
||||||
*/
|
*/
|
||||||
static double
|
double
|
||||||
mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval,
|
mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Datum constval,
|
||||||
double *sumcommonp)
|
double *sumcommonp)
|
||||||
{
|
{
|
||||||
@ -3203,7 +3195,7 @@ get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
|
|||||||
* get_join_variables
|
* get_join_variables
|
||||||
* Apply examine_variable() to each side of a join clause.
|
* Apply examine_variable() to each side of a join clause.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
get_join_variables(PlannerInfo *root, List *args,
|
get_join_variables(PlannerInfo *root, List *args,
|
||||||
VariableStatData *vardata1, VariableStatData *vardata2)
|
VariableStatData *vardata1, VariableStatData *vardata2)
|
||||||
{
|
{
|
||||||
@ -3246,7 +3238,7 @@ get_join_variables(PlannerInfo *root, List *args,
|
|||||||
*
|
*
|
||||||
* Caller is responsible for doing ReleaseVariableStats() before exiting.
|
* Caller is responsible for doing ReleaseVariableStats() before exiting.
|
||||||
*/
|
*/
|
||||||
static void
|
void
|
||||||
examine_variable(PlannerInfo *root, Node *node, int varRelid,
|
examine_variable(PlannerInfo *root, Node *node, int varRelid,
|
||||||
VariableStatData *vardata)
|
VariableStatData *vardata)
|
||||||
{
|
{
|
||||||
@ -3429,7 +3421,7 @@ examine_variable(PlannerInfo *root, Node *node, int varRelid,
|
|||||||
* NB: be careful to produce an integral result, since callers may compare
|
* NB: be careful to produce an integral result, since callers may compare
|
||||||
* the result to exact integer counts.
|
* the result to exact integer counts.
|
||||||
*/
|
*/
|
||||||
static double
|
double
|
||||||
get_variable_numdistinct(VariableStatData *vardata)
|
get_variable_numdistinct(VariableStatData *vardata)
|
||||||
{
|
{
|
||||||
double stadistinct;
|
double stadistinct;
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.30 2006/04/26 22:33:36 momjian Exp $
|
* $PostgreSQL: pgsql/src/include/utils/selfuncs.h,v 1.31 2006/04/27 00:46:59 tgl Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -97,6 +97,19 @@ typedef enum
|
|||||||
|
|
||||||
/* selfuncs.c */
|
/* selfuncs.c */
|
||||||
|
|
||||||
|
extern void examine_variable(PlannerInfo *root, Node *node, int varRelid,
|
||||||
|
VariableStatData *vardata);
|
||||||
|
extern bool get_restriction_variable(PlannerInfo *root, List *args,
|
||||||
|
int varRelid,
|
||||||
|
VariableStatData *vardata, Node **other,
|
||||||
|
bool *varonleft);
|
||||||
|
extern void get_join_variables(PlannerInfo *root, List *args,
|
||||||
|
VariableStatData *vardata1,
|
||||||
|
VariableStatData *vardata2);
|
||||||
|
extern double get_variable_numdistinct(VariableStatData *vardata);
|
||||||
|
extern double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc,
|
||||||
|
Datum constval, double *sumcommonp);
|
||||||
|
|
||||||
extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt,
|
extern Pattern_Prefix_Status pattern_fixed_prefix(Const *patt,
|
||||||
Pattern_Type ptype,
|
Pattern_Type ptype,
|
||||||
Const **prefix,
|
Const **prefix,
|
||||||
@ -154,8 +167,5 @@ extern Selectivity estimate_hash_bucketsize(PlannerInfo *root, Node *hashkey,
|
|||||||
extern Datum btcostestimate(PG_FUNCTION_ARGS);
|
extern Datum btcostestimate(PG_FUNCTION_ARGS);
|
||||||
extern Datum hashcostestimate(PG_FUNCTION_ARGS);
|
extern Datum hashcostestimate(PG_FUNCTION_ARGS);
|
||||||
extern Datum gistcostestimate(PG_FUNCTION_ARGS);
|
extern Datum gistcostestimate(PG_FUNCTION_ARGS);
|
||||||
extern bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid,
|
|
||||||
VariableStatData *vardata, Node **other,
|
|
||||||
bool *varonleft);
|
|
||||||
|
|
||||||
#endif /* SELFUNCS_H */
|
#endif /* SELFUNCS_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user