MobilityDB  1.0
time_analyze.h
Go to the documentation of this file.
1 /*****************************************************************************
2  *
3  * This MobilityDB code is provided under The PostgreSQL License.
4  *
5  * Copyright (c) 2016-2021, Université libre de Bruxelles and MobilityDB
6  * contributors
7  *
8  * MobilityDB includes portions of PostGIS version 3 source code released
9  * under the GNU General Public License (GPLv2 or later).
10  * Copyright (c) 2001-2021, PostGIS contributors
11  *
12  * Permission to use, copy, modify, and distribute this software and its
13  * documentation for any purpose, without fee, and without a written
14  * agreement is hereby granted, provided that the above copyright notice and
15  * this paragraph and the following two paragraphs appear in all copies.
16  *
17  * IN NO EVENT SHALL UNIVERSITE LIBRE DE BRUXELLES BE LIABLE TO ANY PARTY FOR
18  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
19  * LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
20  * EVEN IF UNIVERSITE LIBRE DE BRUXELLES HAS BEEN ADVISED OF THE POSSIBILITY
21  * OF SUCH DAMAGE.
22  *
23  * UNIVERSITE LIBRE DE BRUXELLES SPECIFICALLY DISCLAIMS ANY WARRANTIES,
24  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
25  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON
26  * AN "AS IS" BASIS, AND UNIVERSITE LIBRE DE BRUXELLES HAS NO OBLIGATIONS TO
27  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 
28  *
29  *****************************************************************************/
30 
36 #ifndef __TIME_ANALYZE_H__
37 #define __TIME_ANALYZE_H__
38 
39 #include <postgres.h>
40 #include <fmgr.h>
41 #include <catalog/pg_type.h>
42 #include <commands/vacuum.h>
43 
44 #include "period.h"
45 
46 /*
47  * It is not possible to differentiate bound histogram of ranges and of periods
48  * with the combinination stakind/staop values, since the staop is not set by
49  * the compute_range_stats function and thus it is necessary to define a new stakind
50  */
51 #define STATISTIC_KIND_PERIOD_BOUNDS_HISTOGRAM 8
52 /*
53  * It is not possible to differentiate lengths of ranges and lengths of periods
54  * with the combinination stakind/staop values, since the lenghts are expressed
55  * with float8 values and thus it is necessary to define a new stakind
56  */
57 #define STATISTIC_KIND_PERIOD_LENGTH_HISTOGRAM 9
58 
59 /*****************************************************************************/
60 
61 extern int period_bound_qsort_cmp(const void *a1, const void *a2);
62 extern int float8_qsort_cmp(const void *a1, const void *a2);
63 extern void period_compute_stats1(VacAttrStats *stats, int non_null_cnt, int *slot_idx,
64  PeriodBound *lowers, PeriodBound *uppers, float8 *lengths);
65 
66 extern Datum period_analyze(PG_FUNCTION_ARGS);
67 extern Datum timestampset_analyze(PG_FUNCTION_ARGS);
68 extern Datum periodset_analyze(PG_FUNCTION_ARGS);
69 
70 /*****************************************************************************/
71 
72 #endif
Basic routines for time periods composed of two TimestampTz values and two Boolean values stating whe...
Datum periodset_analyze(PG_FUNCTION_ARGS)
Compute statistics for period set columns.
Definition: time_analyze.c:427
Internal representation of either bound of a period (not what&#39;s on disk)
Definition: timetypes.h:63
int period_bound_qsort_cmp(const void *a1, const void *a2)
Comparison function for sorting period bounds.
Definition: period.c:159
Datum period_analyze(PG_FUNCTION_ARGS)
Compute statistics for period columns.
Definition: time_analyze.c:355
Datum timestampset_analyze(PG_FUNCTION_ARGS)
Compute statistics for timestamp set columns.
Definition: time_analyze.c:391
void period_compute_stats1(VacAttrStats *stats, int non_null_cnt, int *slot_idx, PeriodBound *lowers, PeriodBound *uppers, float8 *lengths)
Compute statistics for period columns and for the time dimension of all temporal types whose subtype ...
Definition: time_analyze.c:96
int float8_qsort_cmp(const void *a1, const void *a2)
Comparison function for sorting float8 values, used for period lengths.
Definition: time_analyze.c:73