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 15:15:32 Functions: 100.0 % 6 6 6
Baseline: 15
Baseline Date: 2023-04-08 15:09:40
Legend: Lines: hit not hit

           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
      49 CBC         104 : areasel(PG_FUNCTION_ARGS)
      50                 : {
      51             104 :     PG_RETURN_FLOAT8(0.005);
      52                 : }
      53                 : 
      54                 : Datum
      55              33 : areajoinsel(PG_FUNCTION_ARGS)
      56                 : {
      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
      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                 : {
      89             338 :     PG_RETURN_FLOAT8(0.001);
      90                 : }
      91                 : 
      92                 : Datum
      93              15 : contjoinsel(PG_FUNCTION_ARGS)
      94                 : {
      95              15 :     PG_RETURN_FLOAT8(0.001);
      96                 : }
        

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