Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar-based chunking PoC #7006

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions sql/ddl_api.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ CREATE OR REPLACE FUNCTION @[email protected]_hypertable(
migrate_data BOOLEAN = FALSE,
chunk_target_size TEXT = NULL,
chunk_sizing_func REGPROC = '_timescaledb_functions.calculate_chunk_interval'::regproc,
time_partitioning_func REGPROC = NULL
time_partitioning_func REGPROC = NULL,
origin ANYELEMENT = NULL::timestamptz
) RETURNS TABLE(hypertable_id INT, schema_name NAME, table_name NAME, created BOOL) AS '@MODULE_PATHNAME@', 'ts_hypertable_create' LANGUAGE C VOLATILE;

-- A generalized hypertable creation API that can be used to convert a PostgreSQL table
Expand All @@ -53,7 +54,6 @@ CREATE OR REPLACE FUNCTION @[email protected]_hypertable(
migrate_data BOOLEAN = FALSE
) RETURNS TABLE(hypertable_id INT, created BOOL) AS '@MODULE_PATHNAME@', 'ts_hypertable_create_general' LANGUAGE C VOLATILE;


-- Set adaptive chunking. To disable, set chunk_target_size => 'off'.
CREATE OR REPLACE FUNCTION @[email protected]_adaptive_chunking(
hypertable REGCLASS,
Expand All @@ -73,7 +73,8 @@ CREATE OR REPLACE FUNCTION @[email protected]_adaptive_chunking(
CREATE OR REPLACE FUNCTION @[email protected]_chunk_time_interval(
hypertable REGCLASS,
chunk_time_interval ANYELEMENT,
dimension_name NAME = NULL
dimension_name NAME = NULL,
origin TIMESTAMPTZ = NULL
) RETURNS VOID AS '@MODULE_PATHNAME@', 'ts_dimension_set_interval' LANGUAGE C VOLATILE;

-- Update partition_interval for a hypertable.
Expand Down Expand Up @@ -133,7 +134,8 @@ CREATE OR REPLACE FUNCTION @[email protected]_dimension(
number_partitions INTEGER = NULL,
chunk_time_interval ANYELEMENT = NULL::BIGINT,
partitioning_func REGPROC = NULL,
if_not_exists BOOLEAN = FALSE
if_not_exists BOOLEAN = FALSE,
origin ANYELEMENT = NULL::timestamptz
) RETURNS TABLE(dimension_id INT, schema_name NAME, table_name NAME, column_name NAME, created BOOL)
AS '@MODULE_PATHNAME@', 'ts_dimension_add' LANGUAGE C VOLATILE;

Expand All @@ -156,7 +158,8 @@ CREATE OR REPLACE FUNCTION @[email protected]_hash(column_name NAME, number_partitio

CREATE OR REPLACE FUNCTION @[email protected]_range(column_name NAME,
partition_interval ANYELEMENT = NULL::bigint,
partition_func regproc = NULL)
partition_func regproc = NULL,
partition_origin "any" = NULL::TIMESTAMPTZ)
RETURNS _timescaledb_internal.dimension_info LANGUAGE C
AS '@MODULE_PATHNAME@', 'ts_range_dimension';

Expand Down
5 changes: 4 additions & 1 deletion sql/pre_install/tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,12 @@ CREATE TABLE _timescaledb_catalog.dimension (
partitioning_func_schema name NULL,
partitioning_func name NULL,
-- open dimensions (e.g., time)
interval_length bigint NULL,
interval_origin bigint NOT NULL, -- origin of when to start chunk interval. TimestampTz or int64 (but always stored as a bigint).
interval interval NULL, -- calendar-based interval.
interval_length bigint NULL, -- integer-based interval
-- compress interval is used by rollup procedure during compression
-- in order to merge multiple chunks into a single one
compress_interval interval NULL,
compress_interval_length bigint NULL,
integer_now_func_schema name NULL,
integer_now_func name NULL,
Expand Down
Loading
Loading