PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <math.h>
#include "access/htup_details.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
#include "utils/fmgrprotos.h"
#include "utils/inet.h"
#include "utils/lsyscache.h"
#include "utils/selfuncs.h"
Go to the source code of this file.
Macros | |
#define | DEFAULT_OVERLAP_SEL 0.01 |
#define | DEFAULT_INCLUSION_SEL 0.005 |
#define | DEFAULT_SEL(operator) |
#define | MAX_CONSIDERED_ELEMS 1024 |
Functions | |
static Selectivity | networkjoinsel_inner (Oid operator, VariableStatData *vardata1, VariableStatData *vardata2) |
static Selectivity | networkjoinsel_semi (Oid operator, VariableStatData *vardata1, VariableStatData *vardata2) |
static Selectivity | mcv_population (float4 *mcv_numbers, int mcv_nvalues) |
static Selectivity | inet_hist_value_sel (Datum *values, int nvalues, Datum constvalue, int opr_codenum) |
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) |
static Selectivity | inet_mcv_hist_sel (Datum *mcv_values, float4 *mcv_numbers, int mcv_nvalues, Datum *hist_values, int hist_nvalues, int opr_codenum) |
static Selectivity | inet_hist_inclusion_join_sel (Datum *hist1_values, int hist1_nvalues, Datum *hist2_values, int hist2_nvalues, int opr_codenum) |
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_opr_codenum (Oid operator) |
static int | inet_inclusion_cmp (inet *left, inet *right, int opr_codenum) |
static int | inet_masklen_inclusion_cmp (inet *left, inet *right, int opr_codenum) |
static int | inet_hist_match_divider (inet *boundary, inet *query, int opr_codenum) |
Datum | networksel (PG_FUNCTION_ARGS) |
Datum | networkjoinsel (PG_FUNCTION_ARGS) |
#define DEFAULT_INCLUSION_SEL 0.005 |
Definition at line 36 of file network_selfuncs.c.
#define DEFAULT_OVERLAP_SEL 0.01 |
Definition at line 33 of file network_selfuncs.c.
#define DEFAULT_SEL | ( | operator | ) |
Definition at line 39 of file network_selfuncs.c.
#define MAX_CONSIDERED_ELEMS 1024 |
Definition at line 44 of file network_selfuncs.c.
|
static |
Definition at line 742 of file network_selfuncs.c.
References i, inet_hist_value_sel(), and MAX_CONSIDERED_ELEMS.
Referenced by networkjoinsel_inner().
Definition at line 939 of file network_selfuncs.c.
References bitncommon(), inet_masklen_inclusion_cmp(), ip_addr, ip_bits, ip_family, and Min.
Referenced by inet_hist_value_sel().
|
static |
Definition at line 604 of file network_selfuncs.c.
References DatumGetInetPP(), i, inet_hist_match_divider(), inet_inclusion_cmp(), Max, MAX_CONSIDERED_ELEMS, and values.
Referenced by inet_hist_inclusion_join_sel(), inet_mcv_hist_sel(), inet_semi_join_sel(), and networksel().
Definition at line 879 of file network_selfuncs.c.
References bitncmp(), inet_masklen_inclusion_cmp(), ip_addr, ip_bits, ip_family, and Min.
Referenced by inet_hist_value_sel().
Definition at line 905 of file network_selfuncs.c.
References ip_bits.
Referenced by inet_hist_match_divider(), and inet_inclusion_cmp().
|
static |
Definition at line 705 of file network_selfuncs.c.
References i, and inet_hist_value_sel().
Referenced by networkjoinsel_inner().
|
static |
Definition at line 673 of file network_selfuncs.c.
References DatumGetBool(), fmgr_info(), FunctionCall2, get_opcode(), i, and j.
Referenced by networkjoinsel_inner().
|
static |
Definition at line 836 of file network_selfuncs.c.
Referenced by networkjoinsel_inner(), networkjoinsel_semi(), and networksel().
|
static |
Definition at line 793 of file network_selfuncs.c.
References DatumGetBool(), FunctionCall2, i, inet_hist_value_sel(), and Min.
Referenced by networkjoinsel_semi().
|
static |
Definition at line 539 of file network_selfuncs.c.
References i.
Referenced by networkjoinsel_inner(), and networkjoinsel_semi().
Datum networkjoinsel | ( | PG_FUNCTION_ARGS | ) |
Definition at line 196 of file network_selfuncs.c.
References generate_unaccent_rules::args, CLAMP_PROBABILITY, elog, ERROR, get_commutator(), get_join_variables(), JOIN_ANTI, JOIN_FULL, JOIN_INNER, JOIN_LEFT, JOIN_SEMI, SpecialJoinInfo::jointype, networkjoinsel_inner(), networkjoinsel_semi(), PG_GETARG_INT16, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_FLOAT8, ReleaseVariableStats, and root.
|
static |
Definition at line 263 of file network_selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, DEFAULT_SEL, free_attstatsslot(), get_attstatsslot(), GETSTRUCT, HeapTupleIsValid, inet_hist_inclusion_join_sel(), inet_mcv_hist_sel(), inet_mcv_join_sel(), inet_opr_codenum(), InvalidOid, MAX_CONSIDERED_ELEMS, mcv_population(), Min, AttStatsSlot::numbers, AttStatsSlot::nvalues, VariableStatData::statsTuple, and AttStatsSlot::values.
Referenced by networkjoinsel().
|
static |
Definition at line 390 of file network_selfuncs.c.
References ATTSTATSSLOT_NUMBERS, ATTSTATSSLOT_VALUES, DEFAULT_SEL, fmgr_info(), free_attstatsslot(), get_attstatsslot(), get_opcode(), GETSTRUCT, HeapTupleIsValid, i, if(), inet_opr_codenum(), inet_semi_join_sel(), InvalidOid, MAX_CONSIDERED_ELEMS, mcv_population(), Min, AttStatsSlot::numbers, AttStatsSlot::nvalues, VariableStatData::rel, RelOptInfo::rows, VariableStatData::statsTuple, and AttStatsSlot::values.
Referenced by networkjoinsel().
Datum networksel | ( | PG_FUNCTION_ARGS | ) |
Definition at line 79 of file network_selfuncs.c.
References generate_unaccent_rules::args, ATTSTATSSLOT_VALUES, CLAMP_PROBABILITY, DEFAULT_SEL, fmgr_info(), free_attstatsslot(), get_attstatsslot(), get_opcode(), get_restriction_variable(), GETSTRUCT, HeapTupleIsValid, inet_hist_value_sel(), inet_opr_codenum(), InvalidOid, IsA, mcv_selectivity(), AttStatsSlot::nvalues, PG_GETARG_INT32, PG_GETARG_OID, PG_GETARG_POINTER, PG_RETURN_FLOAT8, ReleaseVariableStats, root, VariableStatData::statsTuple, and AttStatsSlot::values.