mirror of
https://github.com/postgres/postgres.git
synced 2025-11-24 00:23:06 +03:00
as determined by include-what-you-use (IWYU) While IWYU also suggests to *add* a bunch of #include's (which is its main purpose), this patch does not do that. In some cases, a more specific #include replaces another less specific one. Some manual adjustments of the automatic result: - IWYU currently doesn't know about includes that provide global variable declarations (like -Wmissing-variable-declarations), so those includes are being kept manually. - All includes for port(ability) headers are being kept for now, to play it safe. - No changes of catalog/pg_foo.h to catalog/pg_foo_d.h, to keep the patch from exploding in size. Note that this patch touches just *.c files, so nothing declared in header files changes in hidden ways. As a small example, in src/backend/access/transam/rmgr.c, some IWYU pragma annotations are added to handle a special case there. Discussion: https://www.postgresql.org/message-id/flat/af837490-6b2f-46df-ba05-37ea6a6653fc%40eisentraut.org
96 lines
2.3 KiB
C
96 lines
2.3 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* geo_selfuncs.c
|
|
* Selectivity routines registered in the operator catalog in the
|
|
* "oprrest" and "oprjoin" attributes.
|
|
*
|
|
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
*
|
|
* IDENTIFICATION
|
|
* src/backend/utils/adt/geo_selfuncs.c
|
|
*
|
|
* XXX These are totally bogus. Perhaps someone will make them do
|
|
* something reasonable, someday.
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#include "postgres.h"
|
|
|
|
#include "utils/fmgrprotos.h"
|
|
|
|
|
|
/*
|
|
* Selectivity functions for geometric operators. These are bogus -- unless
|
|
* we know the actual key distribution in the index, we can't make a good
|
|
* prediction of the selectivity of these operators.
|
|
*
|
|
* Note: the values used here may look unreasonably small. Perhaps they
|
|
* are. For now, we want to make sure that the optimizer will make use
|
|
* of a geometric index if one is available, so the selectivity had better
|
|
* be fairly small.
|
|
*
|
|
* In general, GiST needs to search multiple subtrees in order to guarantee
|
|
* that all occurrences of the same key have been found. Because of this,
|
|
* the estimated cost for scanning the index ought to be higher than the
|
|
* output selectivity would indicate. gistcostestimate(), over in selfuncs.c,
|
|
* ought to be adjusted accordingly --- but until we can generate somewhat
|
|
* realistic numbers here, it hardly matters...
|
|
*/
|
|
|
|
|
|
/*
|
|
* Selectivity for operators that depend on area, such as "overlap".
|
|
*/
|
|
|
|
Datum
|
|
areasel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.005);
|
|
}
|
|
|
|
Datum
|
|
areajoinsel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.005);
|
|
}
|
|
|
|
/*
|
|
* positionsel
|
|
*
|
|
* How likely is a box to be strictly left of (right of, above, below)
|
|
* a given box?
|
|
*/
|
|
|
|
Datum
|
|
positionsel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.1);
|
|
}
|
|
|
|
Datum
|
|
positionjoinsel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.1);
|
|
}
|
|
|
|
/*
|
|
* contsel -- How likely is a box to contain (be contained by) a given box?
|
|
*
|
|
* This is a tighter constraint than "overlap", so produce a smaller
|
|
* estimate than areasel does.
|
|
*/
|
|
|
|
Datum
|
|
contsel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.001);
|
|
}
|
|
|
|
Datum
|
|
contjoinsel(PG_FUNCTION_ARGS)
|
|
{
|
|
PG_RETURN_FLOAT8(0.001);
|
|
}
|