* This file and its contents are licensed under the Apache License 2.0.
* Please see the included NOTICE for copyright information and
* LICENSE-APACHE for a copy of the license.
*/
#include <postgres.h>
#include <utils/guc.h>
#include <miscadmin.h>
#include "guc.h"
#include "license_guc.h"
#include "config.h"
#include "hypertable_cache.h"
#include "telemetry/telemetry.h"
* of type TelemetryLevel in the code, otherwise pgindent won't work for the
* type */
bool
ts_telemetry_on()
{
return ts_guc_telemetry_level == on_level;
}
static void
assign_max_cached_chunks_per_hypertable_hook(int newval, void *extra)
{
ts_hypertable_cache_invalidate_callback();
}
void
_guc_init(void)
{
DefineCustomBoolVariable("timescaledb.disable_optimizations",
"Disable all timescale query optimizations",
NULL,
&ts_guc_disable_optimizations,
false,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.optimize_non_hypertables",
"Apply timescale query optimization to plain tables",
"Apply timescale query optimization to plain tables in addition to "
"hypertables",
&ts_guc_optimize_non_hypertables,
false,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.restoring",
"Install timescale in restoring mode",
"Used for running pg_restore",
&ts_guc_restoring,
false,
PGC_SUSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.constraint_aware_append",
"Enable constraint-aware append scans",
"Enable constraint exclusion at execution time",
&ts_guc_constraint_aware_append,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_ordered_append",
"Enable ordered append scans",
"Enable ordered append optimization for queries that are ordered by "
"the time dimension",
&ts_guc_enable_ordered_append,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_chunk_append",
"Enable chunk append node",
"Enable using chunk append node",
&ts_guc_enable_chunk_append,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_parallel_chunk_append",
"Enable parallel chunk append node",
"Enable using parallel aware chunk append node",
&ts_guc_enable_parallel_chunk_append,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_runtime_exclusion",
"Enable runtime chunk exclusion",
"Enable runtime chunk exclusion in ChunkAppend node",
&ts_guc_enable_runtime_exclusion,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_constraint_exclusion",
"Enable constraint exclusion",
"Enable planner constraint exclusion",
&ts_guc_enable_constraint_exclusion,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_transparent_decompression",
"Enable transparent decompression",
"Enable transparent decompression when querying hypertable",
&ts_guc_enable_transparent_decompression,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomBoolVariable("timescaledb.enable_cagg_reorder_groupby",
"Enable group by reordering",
"Enable group by clause reordering for continuous aggregates",
&ts_guc_enable_cagg_reorder_groupby,
true,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomIntVariable("timescaledb.max_open_chunks_per_insert",
"Maximum open chunks per insert",
"Maximum number of open chunk tables per insert",
&ts_guc_max_open_chunks_per_insert,
Min(u_sess->attr.attr_memory.work_mem * INT64CONST(1024) / INT64CONST(25000),
PG_INT16_MAX),
* `MemoryContextStats(TopMemoryContext)`
* show chunk insert
* state memory context
* takes up ~25K bytes
* (work_mem is in
* kbytes) */
0,
PG_INT16_MAX,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomIntVariable("timescaledb.max_cached_chunks_per_hypertable",
"Maximum cached chunks",
"Maximum number of chunks stored in the cache",
&ts_guc_max_cached_chunks_per_hypertable,
100,
0,
65536,
PGC_USERSET,
0,
NULL,
assign_max_cached_chunks_per_hypertable_hook,
NULL);
DefineCustomEnumVariable("timescaledb.telemetry_level",
"Telemetry settings level",
"Level used to determine which telemetry to send",
&ts_guc_telemetry_level,
TELEMETRY_DEFAULT,
telemetry_level_options,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
DefineCustomStringVariable( "timescaledb.license_key",
"TimescaleDB license key",
"Determines which features are enabled",
&ts_guc_license_key,
TS_DEFAULT_LICENSE,
PGC_SUSET,
GUC_SUPERUSER_ONLY,
ts_license_update_check,
ts_license_on_assign,
NULL);
DefineCustomStringVariable( "timescaledb.last_tuned",
"last tune run",
"records last time timescaledb-tune ran",
&ts_last_tune_time,
NULL,
PGC_SIGHUP,
0,
NULL,
NULL,
NULL);
DefineCustomStringVariable( "timescaledb.last_tuned_version",
"version of timescaledb-tune",
"version of timescaledb-tune used to tune",
&ts_last_tune_version,
NULL,
PGC_SIGHUP,
0,
NULL,
NULL,
NULL);
DefineCustomStringVariable( "timescaledb_telemetry.cloud",
"cloud provider",
"cloud provider used for this instance",
&ts_telemetry_cloud,
NULL,
PGC_SIGHUP,
0,
NULL,
NULL,
NULL);
#ifdef TS_DEBUG
DefineCustomBoolVariable( "timescaledb.shutdown_bgw_scheduler",
"immediately shutdown the bgw scheduler",
"this is for debugging purposes",
&ts_shutdown_bgw,
false,
PGC_SIGHUP,
0,
NULL,
NULL,
NULL);
DefineCustomStringVariable( "timescaledb.current_timestamp_mock",
"set the current timestamp",
"this is for debugging purposes",
&ts_current_timestamp_mock,
NULL,
PGC_USERSET,
0,
NULL,
NULL,
NULL);
#endif
}
void
_guc_fini(void)
{
}