LCOV - differential code coverage report
Current view: top level - src/backend/utils/adt - geo_selfuncs.c (source / functions) Coverage Total Hit CBC
Current: c70b6db34ffeab48beef1fb4ce61bcad3772b8dd vs 06473f5a344df8c9594ead90a609b86f6724cff8 Lines: 100.0 % 12 12 12
Current Date: 2025-09-06 07:49:51 +0900 Functions: 100.0 % 6 6 6
Baseline: lcov-20250906-005545-baseline Line coverage date bins:
Baseline Date: 2025-09-05 08:21:35 +0100 (360..) days: 100.0 % 12 12 12
Legend: Lines:     hit not hit Function coverage date bins:
(360..) days: 100.0 % 6 6 6

 Age         Owner                  TLA  Line data    Source code
                                  1                 : /*-------------------------------------------------------------------------
                                  2                 :  *
                                  3                 :  * geo_selfuncs.c
                                  4                 :  *    Selectivity routines registered in the operator catalog in the
                                  5                 :  *    "oprrest" and "oprjoin" attributes.
                                  6                 :  *
                                  7                 :  * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
                                  8                 :  * Portions Copyright (c) 1994, Regents of the University of California
                                  9                 :  *
                                 10                 :  *
                                 11                 :  * IDENTIFICATION
                                 12                 :  *    src/backend/utils/adt/geo_selfuncs.c
                                 13                 :  *
                                 14                 :  *  XXX These are totally bogus.  Perhaps someone will make them do
                                 15                 :  *  something reasonable, someday.
                                 16                 :  *
                                 17                 :  *-------------------------------------------------------------------------
                                 18                 :  */
                                 19                 : #include "postgres.h"
                                 20                 : 
                                 21                 : #include "utils/fmgrprotos.h"
                                 22                 : 
                                 23                 : 
                                 24                 : /*
                                 25                 :  *  Selectivity functions for geometric operators.  These are bogus -- unless
                                 26                 :  *  we know the actual key distribution in the index, we can't make a good
                                 27                 :  *  prediction of the selectivity of these operators.
                                 28                 :  *
                                 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 a geometric index if one is available, so the selectivity had better
                                 32                 :  *  be fairly small.
                                 33                 :  *
                                 34                 :  *  In general, GiST needs 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.  gistcostestimate(), over in selfuncs.c,
                                 38                 :  *  ought to be adjusted accordingly --- but until we can generate somewhat
                                 39                 :  *  realistic numbers here, it hardly matters...
                                 40                 :  */
                                 41                 : 
                                 42                 : 
                                 43                 : /*
                                 44                 :  * Selectivity for operators that depend on area, such as "overlap".
                                 45                 :  */
                                 46                 : 
                                 47                 : Datum
 9224 tgl@sss.pgh.pa.us          48 CBC         104 : areasel(PG_FUNCTION_ARGS)
                                 49                 : {
 8969                            50             104 :     PG_RETURN_FLOAT8(0.005);
                                 51                 : }
                                 52                 : 
                                 53                 : Datum
 9224                            54              33 : areajoinsel(PG_FUNCTION_ARGS)
                                 55                 : {
 8969                            56              33 :     PG_RETURN_FLOAT8(0.005);
                                 57                 : }
                                 58                 : 
                                 59                 : /*
                                 60                 :  *  positionsel
                                 61                 :  *
                                 62                 :  * How likely is a box to be strictly left of (right of, above, below)
                                 63                 :  * a given box?
                                 64                 :  */
                                 65                 : 
                                 66                 : Datum
 9224                            67             467 : positionsel(PG_FUNCTION_ARGS)
                                 68                 : {
                                 69             467 :     PG_RETURN_FLOAT8(0.1);
                                 70                 : }
                                 71                 : 
                                 72                 : Datum
                                 73              57 : positionjoinsel(PG_FUNCTION_ARGS)
                                 74                 : {
                                 75              57 :     PG_RETURN_FLOAT8(0.1);
                                 76                 : }
                                 77                 : 
                                 78                 : /*
                                 79                 :  *  contsel -- How likely is a box to contain (be contained by) a given box?
                                 80                 :  *
                                 81                 :  * This is a tighter constraint than "overlap", so produce a smaller
                                 82                 :  * estimate than areasel does.
                                 83                 :  */
                                 84                 : 
                                 85                 : Datum
                                 86             338 : contsel(PG_FUNCTION_ARGS)
                                 87                 : {
 8969                            88             338 :     PG_RETURN_FLOAT8(0.001);
                                 89                 : }
                                 90                 : 
                                 91                 : Datum
 9224                            92              15 : contjoinsel(PG_FUNCTION_ARGS)
                                 93                 : {
 8969                            94              15 :     PG_RETURN_FLOAT8(0.001);
                                 95                 : }
        

Generated by: LCOV version 2.4-beta