1
/*-------------------------------------------------------------------------
4
* Selectivity routines registered in the operator catalog in the
5
* "oprrest" and "oprjoin" attributes.
7
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
8
* Portions Copyright (c) 1994, Regents of the University of California
12
* $PostgreSQL: pgsql/src/backend/utils/adt/geo_selfuncs.c,v 1.24 2004-12-31 22:01:22 pgsql Exp $
14
* XXX These are totally bogus. Perhaps someone will make them do
15
* something reasonable, someday.
17
*-------------------------------------------------------------------------
21
#include "utils/geo_decls.h"
25
* Selectivity functions for rtrees. These are bogus -- unless we know
26
* the actual key distribution in the index, we can't make a good prediction
27
* of the selectivity of these operators.
29
* Note: the values used here may look unreasonably small. Perhaps they
30
* are. For now, we want to make sure that the optimizer will make use
31
* of an r-tree index if one is available, so the selectivity had better
34
* In general, rtrees need to search multiple subtrees in order to guarantee
35
* that all occurrences of the same key have been found. Because of this,
36
* the estimated cost for scanning the index ought to be higher than the
37
* output selectivity would indicate. rtcostestimate(), over in selfuncs.c,
38
* ought to be adjusted accordingly --- but until we can generate somewhat
39
* realistic numbers here, it hardly matters...
44
* Selectivity for operators that depend on area, such as "overlap".
48
areasel(PG_FUNCTION_ARGS)
50
PG_RETURN_FLOAT8(0.005);
54
areajoinsel(PG_FUNCTION_ARGS)
56
PG_RETURN_FLOAT8(0.005);
62
* How likely is a box to be strictly left of (right of, above, below)
67
positionsel(PG_FUNCTION_ARGS)
69
PG_RETURN_FLOAT8(0.1);
73
positionjoinsel(PG_FUNCTION_ARGS)
75
PG_RETURN_FLOAT8(0.1);
79
* contsel -- How likely is a box to contain (be contained by) a given box?
81
* This is a tighter constraint than "overlap", so produce a smaller
82
* estimate than areasel does.
86
contsel(PG_FUNCTION_ARGS)
88
PG_RETURN_FLOAT8(0.001);
92
contjoinsel(PG_FUNCTION_ARGS)
94
PG_RETURN_FLOAT8(0.001);