26#include "utils/fmgrprotos.h"
33#define DEFAULT_OVERLAP_SEL 0.01
36#define DEFAULT_INCLUSION_SEL 0.005
39#define DEFAULT_SEL(operator) \
40 ((operator) == OID_INET_OVERLAP_OP ? \
41 DEFAULT_OVERLAP_SEL : DEFAULT_INCLUSION_SEL)
44#define MAX_CONSIDERED_ELEMS 1024
236 elog(
ERROR,
"unrecognized join type: %d",
633 for (
i = k;
i < nvalues;
i += k)
851 elog(
ERROR,
"unrecognized operator %u for inet selectivity",
static Datum values[MAXATTR]
void fmgr_info(Oid functionId, FmgrInfo *finfo)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define FunctionCall2(flinfo, arg1, arg2)
#define PG_GETARG_INT32(n)
#define PG_GETARG_INT16(n)
#define HeapTupleIsValid(tuple)
static void * GETSTRUCT(const HeapTupleData *tuple)
void free_attstatsslot(AttStatsSlot *sslot)
RegProcedure get_opcode(Oid opno)
bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple, int reqkind, Oid reqop, int flags)
Oid get_commutator(Oid opno)
#define ATTSTATSSLOT_NUMBERS
#define ATTSTATSSLOT_VALUES
int bitncommon(const unsigned char *l, const unsigned char *r, int n)
int bitncmp(const unsigned char *l, const unsigned char *r, int n)
static int inet_inclusion_cmp(inet *left, inet *right, int opr_codenum)
static int inet_opr_codenum(Oid operator)
static Selectivity networkjoinsel_semi(Oid operator, VariableStatData *vardata1, VariableStatData *vardata2)
static Selectivity inet_semi_join_sel(Datum lhs_value, bool mcv_exists, Datum *mcv_values, int mcv_nvalues, bool hist_exists, Datum *hist_values, int hist_nvalues, double hist_weight, FmgrInfo *proc, int opr_codenum)
static int inet_masklen_inclusion_cmp(inet *left, inet *right, int opr_codenum)
Datum networksel(PG_FUNCTION_ARGS)
static Selectivity mcv_population(float4 *mcv_numbers, int mcv_nvalues)
static Selectivity inet_mcv_join_sel(Datum *mcv1_values, float4 *mcv1_numbers, int mcv1_nvalues, Datum *mcv2_values, float4 *mcv2_numbers, int mcv2_nvalues, Oid operator)
Datum networkjoinsel(PG_FUNCTION_ARGS)
static Selectivity inet_hist_inclusion_join_sel(const Datum *hist1_values, int hist1_nvalues, const Datum *hist2_values, int hist2_nvalues, int opr_codenum)
static Selectivity inet_mcv_hist_sel(const Datum *mcv_values, float4 *mcv_numbers, int mcv_nvalues, const Datum *hist_values, int hist_nvalues, int opr_codenum)
#define MAX_CONSIDERED_ELEMS
static Selectivity inet_hist_value_sel(const Datum *values, int nvalues, Datum constvalue, int opr_codenum)
static int inet_hist_match_divider(inet *boundary, inet *query, int opr_codenum)
static Selectivity networkjoinsel_inner(Oid operator, VariableStatData *vardata1, VariableStatData *vardata2)
#define DEFAULT_SEL(operator)
#define IsA(nodeptr, _type_)
FormData_pg_statistic * Form_pg_statistic
static bool DatumGetBool(Datum X)
bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid, VariableStatData *vardata, Node **other, bool *varonleft)
double mcv_selectivity(VariableStatData *vardata, FmgrInfo *opproc, Oid collation, Datum constval, bool varonleft, double *sumcommonp)
void get_join_variables(PlannerInfo *root, List *args, SpecialJoinInfo *sjinfo, VariableStatData *vardata1, VariableStatData *vardata2, bool *join_is_reversed)
#define ReleaseVariableStats(vardata)
#define CLAMP_PROBABILITY(p)
static inet * DatumGetInetPP(Datum X)
#define ip_family(inetptr)