LCOV - differential code coverage report
Current view: top level - src/backend/utils/adt - geo_selfuncs.c (source / functions) Coverage Total Hit CBC
Current: Differential Code Coverage 16@8cea358b128 vs 17@8cea358b128 Lines: 100.0 % 12 12 12
Current Date: 2024-04-14 14:21:10 Functions: 100.0 % 6 6 6
Baseline: 16@8cea358b128 Branches: - 0 0
Baseline Date: 2024-04-14 14:21:09 Line coverage date bins:
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed (240..) days: 100.0 % 12 12 12
Function coverage date bins:
(240..) days: 100.0 % 6 6 6

 Age         Owner                    Branch data    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-2024, 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
 8714 tgl@sss.pgh.pa.us          48                 :CBC         104 : areasel(PG_FUNCTION_ARGS)
                                 49                 :                : {
 8459                            50                 :            104 :     PG_RETURN_FLOAT8(0.005);
                                 51                 :                : }
                                 52                 :                : 
                                 53                 :                : Datum
 8714                            54                 :             33 : areajoinsel(PG_FUNCTION_ARGS)
                                 55                 :                : {
 8459                            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
 8714                            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                 :                : {
 8459                            88                 :            338 :     PG_RETURN_FLOAT8(0.001);
                                 89                 :                : }
                                 90                 :                : 
                                 91                 :                : Datum
 8714                            92                 :             15 : contjoinsel(PG_FUNCTION_ARGS)
                                 93                 :                : {
 8459                            94                 :             15 :     PG_RETURN_FLOAT8(0.001);
                                 95                 :                : }
        

Generated by: LCOV version 2.1-beta2-3-g6141622