MobilityDB 1.3
Loading...
Searching...
No Matches
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-2025, 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-2025, 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 "temporal/meos_catalog.h"
47#include "temporal/temporal.h"
48
49#define BTREE_AM_OID 403
50
54#define DEFAULT_TEMP_SEL 0.0001
55#define DEFAULT_TEMP_JOINSEL 0.001
56
57/*****************************************************************************
58 * Internal selectivity functions for Temporal types.
59 *****************************************************************************/
60
61extern Selectivity scalarineqsel(PlannerInfo *root, Oid operid, bool isgt,
62 bool iseq, VariableStatData *vardata, Datum constval, Oid consttypid);
63extern Selectivity temporal_sel_tstzspan(VariableStatData *vardata, Span *s,
64 meosOper oper);
65
66/*****************************************************************************
67 * Some other helper functions.
68 *****************************************************************************/
69
70extern float8 temporal_sel(PlannerInfo *root, Oid operid, List *args,
71 int varRelid, TemporalFamily tempfamily);
72extern double temporal_sel_family(FunctionCallInfo fcinfo,
73 TemporalFamily tempfamily);
74
75extern double temporal_joinsel(PlannerInfo *root, Oid operid,
76 List *args, JoinType jointype, SpecialJoinInfo *sjinfo,
77 TemporalFamily tempfamily);
78extern double temporal_joinsel_family(FunctionCallInfo fcinfo,
79 TemporalFamily tempfamily);
80
81/*****************************************************************************/
82
83#endif
double float8
Definition: c.h:581
meosOper
Enumeration that defines the classes of Boolean operators used in MobilityDB.
Definition: meos_catalog.h:128
TemporalFamily
Enumeration for the families of temporal types.
Definition: temporal.h:157
External API of the Mobility Engine Open Source (MEOS) library.
unsigned int Oid
Definition: postgres_ext.h:31
uintptr_t Datum
Definition: postgres_ext_defs.in.h:7
Structure to represent spans (a.k.a.
Definition: meos.h:94
double temporal_sel_family(FunctionCallInfo fcinfo, TemporalFamily tempfamily)
Definition: temporal_selfuncs.c:713
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:866
double temporal_joinsel_family(FunctionCallInfo fcinfo, TemporalFamily tempfamily)
Definition: temporal_selfuncs.c:984
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 timestampt...
Definition: temporal_selfuncs.c:557
Selectivity scalarineqsel(PlannerInfo *root, Oid operid, bool isgt, bool iseq, VariableStatData *vardata, Datum constval, Oid consttypid)
Selectivity temporal_sel_tstzspan(VariableStatData *vardata, Span *s, meosOper oper)
Return an estimate of the selectivity of the search period and the operator for columns of temporal v...
Definition: temporal_selfuncs.c:438