33 #define DEFAULT_TS_MATCH_SEL 0.005
51 Datum *mcelem,
int nmcelem,
52 float4 *numbers,
int nnumbers);
57 #define tsquery_opr_selec_no_stats(query) \
58 tsquery_opr_selec(GETQUERY(query), GETOPERAND(query), NULL, 0, 0)
87 &vardata, &other, &varonleft))
102 if (((
Const *) other)->constisnull)
113 if (((
Const *) other)->consttype == TSQUERYOID)
160 if (query->
size == 0)
192 selec *= (1.0 - stats->stanullfrac);
209 float4 *numbers,
int nnumbers)
224 if (nnumbers != nmcelem + 2)
231 for (
i = 0;
i < nmcelem;
i++)
246 minfreq = numbers[nnumbers - 2];
295 key.lexeme = operand +
oper->distance;
320 if (
lookup == NULL || length < 100)
323 matched = allmces = 0;
325 for (
i = 0;
i < length;
i++)
330 if (tlen >=
key.length &&
344 selec = matched + (1.0 - allmces) * ((
double) n_matched / length);
448 else if (len1 < len2)
elog(ERROR, "%s: %s", p2, msg)
#define PG_RETURN_FLOAT8(x)
#define PG_GETARG_POINTER(n)
#define PG_GETARG_INT32(n)
#define HeapTupleIsValid(tuple)
Assert(fmt[strlen(fmt) - 1] !='\n')
void free_attstatsslot(AttStatsSlot *sslot)
bool get_attstatsslot(AttStatsSlot *sslot, HeapTuple statstuple, int reqkind, Oid reqop, int flags)
#define ATTSTATSSLOT_NUMBERS
#define ATTSTATSSLOT_VALUES
void pfree(void *pointer)
#define IsA(nodeptr, _type_)
Operator oper(ParseState *pstate, List *opname, Oid ltypeId, Oid rtypeId, bool noError, int location)
FormData_pg_statistic * Form_pg_statistic
void check_stack_depth(void)
static Pointer DatumGetPointer(Datum X)
bool get_restriction_variable(PlannerInfo *root, List *args, int varRelid, VariableStatData *vardata, Node **other, bool *varonleft)
#define ReleaseVariableStats(vardata)
#define CLAMP_PROBABILITY(p)
#define tsquery_opr_selec_no_stats(query)
#define DEFAULT_TS_MATCH_SEL
Datum tsmatchjoinsel(PG_FUNCTION_ARGS)
static Selectivity tsquery_opr_selec(QueryItem *item, char *operand, TextFreq *lookup, int length, float4 minfreq)
static Selectivity tsquerysel(VariableStatData *vardata, Datum constval)
Datum tsmatchsel(PG_FUNCTION_ARGS)
static int compare_lexeme_textfreq(const void *e1, const void *e2)
static Selectivity mcelem_tsquery_selec(TSQuery query, Datum *mcelem, int nmcelem, float4 *numbers, int nnumbers)
static TSQuery DatumGetTSQuery(Datum X)
#define VARATT_IS_COMPRESSED(PTR)
#define VARATT_IS_EXTERNAL(PTR)
#define VARSIZE_ANY_EXHDR(PTR)