MobilityDB
1.0
|
MobilityDB builds a cache of OIDs in global arrays in order to avoid (slow) lookups. More...
#include "general/tempcache.h"
#include <access/heapam.h>
#include <access/htup_details.h>
#include <catalog/namespace.h>
#include <utils/rel.h>
#include "general/temporaltypes.h"
Functions | |
static void | populate_temptype_cache () |
Populate the Oid cache for temporal types. More... | |
Oid | temporal_basetypid (Oid temptypid) |
Returns the Oid of the base type from the Oid of the temporal type. More... | |
static void | populate_types () |
Populate the Oid cache for types. More... | |
static void | populate_operators () |
Populate the Oid cache for operators. More... | |
Oid | type_oid (CachedType type) |
Fetch from the cache the Oid of a type. More... | |
Oid | oper_oid (CachedOp op, CachedType lt, CachedType rt) |
Fetch from the cache the Oid of an operator. More... | |
PGDLLEXPORT Datum | fill_opcache (PG_FUNCTION_ARGS) |
Function executed during the CREATE EXTENSION to precompute the operator cache and store it as a table in the catalog. More... | |
Variables | |
const char * | _type_names [] |
Global array for caching the names of the types used in MobilityDB to avoid (slow) lookups. More... | |
const char * | _op_names [] |
Global array for caching the names of the operators used in MobilityDB to avoid (slow) lookups. More... | |
bool | _temptype_cache_ready = false |
Global variable that states whether the type and operator caches has been initialized. More... | |
static temptype_cache_struct | _temptype_cache [TEMPTYPE_CACHE_MAX_LEN] |
Global array that keeps type information for the temporal types defined in MobilityDB. More... | |
bool | _ready = false |
Global variable that states whether the type and operator caches has been initialized. More... | |
Oid | _type_oids [sizeof(_type_names)/sizeof(char *)] |
Global array that keeps the Oids of the types used in MobilityDB. More... | |
Oid | _op_oids [sizeof(_op_names)/sizeof(char *)][sizeof(_type_names)/sizeof(char *)][sizeof(_type_names)/sizeof(char *)] |
Global 3-dimensional array that keeps the Oids of the operators used in MobilityDB. More... | |
MobilityDB builds a cache of OIDs in global arrays in order to avoid (slow) lookups.
The global arrays are initialized at the loading of the extension.
The selectivity of Boolean operators is essential to determine efficient execution plans for queries. The temporal extension defines several classes of Boolean operators (equal, less than, overlaps, ...), currently 30, each of which can have as left or right arguments a built-in type (such as integer, timestamptz, box, geometry, ...) or a newly defined type (such as period, tint, ...), currently 33.
There are currently 3,392 operators, each of which is identified by an Oid. To avoid enumerating all of these operators in the Oid cache, we use a two-dimensional array containing all possible combinations of operator/left argument/right argument (currently 23 * 40 * 40 = 36,800 cells). The invalid combinations will be initialized to 0.