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 HEAD vs 15 Lines: 100.0 % 12 12 12
Current Date: 2023-04-08 17:13:01 Functions: 100.0 % 6 6 6
Baseline: 15 Line coverage date bins:
Baseline Date: 2023-04-08 15:09:40 (240..) days: 100.0 % 12 12 12
Legend: Lines: hit not hit Function coverage date bins:
(240..) 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-2023, 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/builtins.h"
                                 22                 : #include "utils/geo_decls.h"
                                 23                 : 
                                 24                 : 
                                 25                 : /*
                                 26                 :  *  Selectivity functions for geometric operators.  These are bogus -- unless
                                 27                 :  *  we know the actual key distribution in the index, we can't make a good
                                 28                 :  *  prediction of the selectivity of these operators.
                                 29                 :  *
                                 30                 :  *  Note: the values used here may look unreasonably small.  Perhaps they
                                 31                 :  *  are.  For now, we want to make sure that the optimizer will make use
                                 32                 :  *  of a geometric index if one is available, so the selectivity had better
                                 33                 :  *  be fairly small.
                                 34                 :  *
                                 35                 :  *  In general, GiST needs to search multiple subtrees in order to guarantee
                                 36                 :  *  that all occurrences of the same key have been found.  Because of this,
                                 37                 :  *  the estimated cost for scanning the index ought to be higher than the
                                 38                 :  *  output selectivity would indicate.  gistcostestimate(), over in selfuncs.c,
                                 39                 :  *  ought to be adjusted accordingly --- but until we can generate somewhat
                                 40                 :  *  realistic numbers here, it hardly matters...
                                 41                 :  */
                                 42                 : 
                                 43                 : 
                                 44                 : /*
                                 45                 :  * Selectivity for operators that depend on area, such as "overlap".
                                 46                 :  */
                                 47                 : 
                                 48                 : Datum
 8343 tgl                        49 CBC         104 : areasel(PG_FUNCTION_ARGS)
                                 50                 : {
 8088                            51             104 :     PG_RETURN_FLOAT8(0.005);
                                 52                 : }
                                 53                 : 
                                 54                 : Datum
 8343                            55              33 : areajoinsel(PG_FUNCTION_ARGS)
                                 56                 : {
 8088                            57              33 :     PG_RETURN_FLOAT8(0.005);
                                 58                 : }
                                 59                 : 
                                 60                 : /*
                                 61                 :  *  positionsel
                                 62                 :  *
                                 63                 :  * How likely is a box to be strictly left of (right of, above, below)
                                 64                 :  * a given box?
                                 65                 :  */
                                 66                 : 
                                 67                 : Datum
 8343                            68             467 : positionsel(PG_FUNCTION_ARGS)
                                 69                 : {
                                 70             467 :     PG_RETURN_FLOAT8(0.1);
                                 71                 : }
                                 72                 : 
                                 73                 : Datum
                                 74              57 : positionjoinsel(PG_FUNCTION_ARGS)
                                 75                 : {
                                 76              57 :     PG_RETURN_FLOAT8(0.1);
                                 77                 : }
                                 78                 : 
                                 79                 : /*
                                 80                 :  *  contsel -- How likely is a box to contain (be contained by) a given box?
                                 81                 :  *
                                 82                 :  * This is a tighter constraint than "overlap", so produce a smaller
                                 83                 :  * estimate than areasel does.
                                 84                 :  */
                                 85                 : 
                                 86                 : Datum
                                 87             338 : contsel(PG_FUNCTION_ARGS)
                                 88                 : {
 8088                            89             338 :     PG_RETURN_FLOAT8(0.001);
                                 90                 : }
                                 91                 : 
                                 92                 : Datum
 8343                            93              15 : contjoinsel(PG_FUNCTION_ARGS)
                                 94                 : {
 8088                            95              15 :     PG_RETURN_FLOAT8(0.001);
                                 96                 : }
        

Generated by: LCOV version v1.16-55-g56c0a2a