MobilityDB 1.1
temporal_selfuncs.h
Go to the documentation of this file.
1/*****************************************************************************
2 *
3 * This MobilityDB code is provided under The PostgreSQL License.
4 * Copyright (c) 2016-2023, Université libre de Bruxelles and MobilityDB
5 * contributors
6 *
7 * MobilityDB includes portions of PostGIS version 3 source code released
8 * under the GNU General Public License (GPLv2 or later).
9 * Copyright (c) 2001-2023, PostGIS contributors
10 *
11 * Permission to use, copy, modify, and distribute this software and its
12 * documentation for any purpose, without fee, and without a written
13 * agreement is hereby granted, provided that the above copyright notice and
14 * this paragraph and the following two paragraphs appear in all copies.
15 *
16 * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
17 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
18 * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
19 * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
20 * OF SUCH DAMAGE.
21 *
22 * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
23 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24 * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
25 * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
26 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
27 *
28 *****************************************************************************/
29
34#ifndef __TEMPORAL_SELFUNCS_H__
35#define __TEMPORAL_SELFUNCS_H__
36
37/* PostgreSQL */
38#include <postgres.h>
39#include <catalog/pg_operator.h>
40#include <commands/vacuum.h>
41#include <utils/lsyscache.h>
42#include <utils/selfuncs.h>
43#include <utils/typcache.h>
44/* MEOS */
45#include <meos.h>
46#include "general/meos_catalog.h"
47#include "general/temporal.h"
48/* MobilityDB */
50
51#define BTREE_AM_OID 403
52
56#define DEFAULT_TEMP_SEL 0.0001
57#define DEFAULT_TEMP_JOINSEL 0.001
58
59/*****************************************************************************
60 * Internal selectivity functions for Temporal types.
61 *****************************************************************************/
62
63extern Selectivity scalarineqsel(PlannerInfo *root, Oid operid, bool isgt,
64 bool iseq, VariableStatData *vardata, Datum constval, Oid consttypid);
65extern Selectivity temporal_sel_period(VariableStatData *vardata, Span *period,
66 meosOper oper);
67
68/*****************************************************************************
69 * Some other helper functions.
70 *****************************************************************************/
71
72extern float8 temporal_sel(PlannerInfo *root, Oid operid, List *args,
73 int varRelid, TemporalFamily tempfamily);
74extern double temporal_sel_ext(FunctionCallInfo fcinfo,
75 TemporalFamily tempfamily);
76
77extern double temporal_joinsel(PlannerInfo *root, Oid operid,
78 List *args, JoinType jointype, SpecialJoinInfo *sjinfo,
79 TemporalFamily tempfamily);
80
81extern double temporal_joinsel_ext(FunctionCallInfo fcinfo,
82 TemporalFamily tempfamily);
83
84/*****************************************************************************/
85
86#endif
double float8
Definition: c.h:570
meosOper
Enumeration that defines the classes of Boolean operators used in MobilityDB.
Definition: meos_catalog.h:107
TemporalFamily
Enumeration for the families of temporal types.
Definition: temporal.h:153
uintptr_t Datum
Definition: pg_ext_defs.in.h:4
unsigned int Oid
Definition: postgres_ext.h:31
Structure to represent spans (a.k.a.
Definition: meos.h:70
Selectivity temporal_sel_period(VariableStatData *vardata, Span *period, meosOper oper)
Return an estimate of the selectivity of the search period and the operator for columns of temporal v...
Definition: temporal_selfuncs.c:500
double temporal_joinsel(PlannerInfo *root, Oid operid, List *args, JoinType jointype, SpecialJoinInfo *sjinfo, TemporalFamily tempfamily)
Return an estimate of the join selectivity for columns of temporal values.
Definition: temporal_selfuncs.c:955
double temporal_sel_ext(FunctionCallInfo fcinfo, TemporalFamily tempfamily)
Definition: temporal_selfuncs.c:794
float8 temporal_sel(PlannerInfo *root, Oid operid, List *args, int varRelid, TemporalFamily tempfamily)
Estimate the selectivity value of the operators for temporal types whose bounding box is a period,...
Definition: temporal_selfuncs.c:638
Selectivity scalarineqsel(PlannerInfo *root, Oid operid, bool isgt, bool iseq, VariableStatData *vardata, Datum constval, Oid consttypid)
double temporal_joinsel_ext(FunctionCallInfo fcinfo, TemporalFamily tempfamily)
Definition: temporal_selfuncs.c:1069