Skip to content

Commit 43ef9b7

Browse files
Release 2.17.0
This release adds support for PostgreSQL 17, significantly improves the performance of continuous aggregate refreshes, and contains performance improvements for analytical queries and delete operations over compressed hypertables. We recommend that you upgrade at the next available opportunity. **Highlighted features in TimescaleDB v2.17.0** * Full PostgreSQL 17 support for all existing features. TimescaleDB v2.17 is available for PostgreSQL 14, 15, 16, and 17. * Significant performance improvements for continuous aggregate policies: continuous aggregate refresh is now using `merge` instead of deleting old materialized data and re-inserting. This update can decrease dramatically the amount of data that must be written on the continuous aggregate in the presence of a small number of changes, reduce the `i/o` cost of refreshing a continuous aggregate, and generate fewer Write-Ahead Logs (`WAL`). Overall, continuous aggregate policies will be more lightweight, use less system resources, and complete faster. * Increased performance for real-time analytical queries over compressed hypertables: we are excited to introduce additional Single Instruction, Multiple Data (`SIMD`) vectorization optimization to our engine by supporting vectorized execution for queries that group by using the `segment_by` column(s) and aggregate using the basic aggregate functions (`sum`, `count`, `avg`, `min`, `max`). Stay tuned for more to come in follow-up releases! Support for grouping on additional columns, filtered aggregation, vectorized expressions, and `time_bucket` is coming soon. * Improved performance of deletes on compressed hypertables when a large amount of data is affected. This improvement speeds up operations that delete whole segments by skipping the decompression step. It is enabled for all deletes that filter by the `segment_by` column(s). **PostgreSQL 14 deprecation announcement** We will continue supporting PostgreSQL 14 until April 2025. Closer to that time, we will announce the specific version of TimescaleDB in which PostgreSQL 14 support will not be included going forward. **Features** * #6882: Allow delete of full segments on compressed chunks without decompression. * #7033: Use `merge` statement on continuous aggregates refresh. * #7126: Add functions to show the compression information. * #7147: Vectorize partial aggregation for `sum(int4)` with grouping on `segment by` columns. * #7204: Track additional extensions in telemetry. * #7207: Refactor the `decompress_batches_scan` functions for easier maintenance. * #7209: Add a function to drop the `osm` chunk. * #7275: Add support for the `returning` clause for `merge`. * #7200: Vectorize common aggregate functions like `min`, `max`, `sum`, `avg`, `stddev`, `variance` for compressed columns of arithmetic types, when there is grouping on `segment by` columns or no grouping. **Bug fixes** * #7187: Fix the string literal length for the `compressed_data_info` function. * #7191: Fix creating default indexes on chunks when migrating the data. * #7195: Fix the `segment by` and `order by` checks when dropping a column from a compressed hypertable. * #7201: Use the generic extension description when building `apt` and `rpm` loader packages. * #7227: Add an index to the `compression_chunk_size` catalog table. * #7229: Fix the foreign key constraints where the index and the constraint column order are different. * #7230: Do not propagate the foreign key constraints to the `osm` chunk. * #7234: Release the cache after accessing the cache entry. * #7258: Force English in the `pg_config` command executed by `cmake` to avoid the unexpected building errors. * #7270: Fix the memory leak in compressed DML batch filtering. * #7286: Fix the index column check while searching for the index. * #7290: Add check for null offset for continuous aggregates built on top of continuous aggregates. * #7301: Make foreign key behavior for hypertables consistent. * #7318: Fix chunk skipping range filtering. * #7320: Set the license specific extension comment in the install script. **Thanks** * @MiguelTubio for reporting and fixing the Windows build error. * @posuch for reporting the misleading extension description in the generic loader packages. * @snyrkill for discovering and reporting the issue with continuous aggregates built on top of continuous aggregates.
1 parent 2959bd4 commit 43ef9b7

32 files changed

+207
-162
lines changed

.unreleased/group_by_segmentby

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_6882

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7033

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7126

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7187

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7191

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7195

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7201

Lines changed: 0 additions & 2 deletions
This file was deleted.

.unreleased/pr_7204

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7207

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7209

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7227

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7229

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7230

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7234

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7258

Lines changed: 0 additions & 2 deletions
This file was deleted.

.unreleased/pr_7270

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7275

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7286

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7290

Lines changed: 0 additions & 2 deletions
This file was deleted.

.unreleased/pr_7295

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7301

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7318

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/pr_7320

Lines changed: 0 additions & 1 deletion
This file was deleted.

.unreleased/vectorize-agg-functions

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,77 @@
44
`psql` with the `-X` flag to prevent any `.psqlrc` commands from
55
accidentally triggering the load of a previous DB version.**
66

7+
8+
## 2.17.0 (2024-10-08)
9+
10+
This release adds support for PostgreSQL 17, significantly improves the performance of continuous aggregate refreshes,
11+
and contains performance improvements for analytical queries and delete operations over compressed hypertables.
12+
We recommend that you upgrade at the next available opportunity.
13+
14+
**Highlighted features in TimescaleDB v2.17.0**
15+
16+
* Full PostgreSQL 17 support for all existing features. TimescaleDB v2.17 is available for PostgreSQL 14, 15, 16, and 17.
17+
18+
* Significant performance improvements for continuous aggregate policies: continuous aggregate refresh is now using
19+
`merge` instead of deleting old materialized data and re-inserting.
20+
21+
This update can decrease dramatically the amount of data that must be written on the continuous aggregate in the
22+
presence of a small number of changes, reduce the `i/o` cost of refreshing a continuous aggregate, and generate fewer
23+
Write-Ahead Logs (`WAL`).
24+
Overall, continuous aggregate policies will be more lightweight, use less system resources, and complete faster.
25+
26+
* Increased performance for real-time analytical queries over compressed hypertables:
27+
we are excited to introduce additional Single Instruction, Multiple Data (`SIMD`) vectorization optimization to our
28+
engine by supporting vectorized execution for queries that group by using the `segment_by` column(s) and
29+
aggregate using the basic aggregate functions (`sum`, `count`, `avg`, `min`, `max`).
30+
31+
Stay tuned for more to come in follow-up releases! Support for grouping on additional columns, filtered aggregation,
32+
vectorized expressions, and `time_bucket` is coming soon.
33+
34+
* Improved performance of deletes on compressed hypertables when a large amount of data is affected.
35+
36+
This improvement speeds up operations that delete whole segments by skipping the decompression step.
37+
It is enabled for all deletes that filter by the `segment_by` column(s).
38+
39+
**PostgreSQL 14 deprecation announcement**
40+
41+
We will continue supporting PostgreSQL 14 until April 2025. Closer to that time, we will announce the specific
42+
version of TimescaleDB in which PostgreSQL 14 support will not be included going forward.
43+
44+
**Features**
45+
* #6882: Allow delete of full segments on compressed chunks without decompression.
46+
* #7033: Use `merge` statement on continuous aggregates refresh.
47+
* #7126: Add functions to show the compression information.
48+
* #7147: Vectorize partial aggregation for `sum(int4)` with grouping on `segment by` columns.
49+
* #7204: Track additional extensions in telemetry.
50+
* #7207: Refactor the `decompress_batches_scan` functions for easier maintenance.
51+
* #7209: Add a function to drop the `osm` chunk.
52+
* #7275: Add support for the `returning` clause for `merge`.
53+
* #7200: Vectorize common aggregate functions like `min`, `max`, `sum`, `avg`, `stddev`, `variance` for compressed columns
54+
of arithmetic types, when there is grouping on `segment by` columns or no grouping.
55+
56+
**Bug fixes**
57+
* #7187: Fix the string literal length for the `compressed_data_info` function.
58+
* #7191: Fix creating default indexes on chunks when migrating the data.
59+
* #7195: Fix the `segment by` and `order by` checks when dropping a column from a compressed hypertable.
60+
* #7201: Use the generic extension description when building `apt` and `rpm` loader packages.
61+
* #7227: Add an index to the `compression_chunk_size` catalog table.
62+
* #7229: Fix the foreign key constraints where the index and the constraint column order are different.
63+
* #7230: Do not propagate the foreign key constraints to the `osm` chunk.
64+
* #7234: Release the cache after accessing the cache entry.
65+
* #7258: Force English in the `pg_config` command executed by `cmake` to avoid the unexpected building errors.
66+
* #7270: Fix the memory leak in compressed DML batch filtering.
67+
* #7286: Fix the index column check while searching for the index.
68+
* #7290: Add check for null offset for continuous aggregates built on top of continuous aggregates.
69+
* #7301: Make foreign key behavior for hypertables consistent.
70+
* #7318: Fix chunk skipping range filtering.
71+
* #7320: Set the license specific extension comment in the install script.
72+
73+
**Thanks**
74+
* @MiguelTubio for reporting and fixing the Windows build error.
75+
* @posuch for reporting the misleading extension description in the generic loader packages.
76+
* @snyrkill for discovering and reporting the issue with continuous aggregates built on top of continuous aggregates.
77+
778
## 2.16.1 (2024-08-06)
879

980
This release contains bug fixes since the 2.16.0 release. We recommend

sql/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,12 @@ set(MOD_FILES
4242
updates/2.15.1--2.15.2.sql
4343
updates/2.15.2--2.15.3.sql
4444
updates/2.15.3--2.16.0.sql
45-
updates/2.16.0--2.16.1.sql)
45+
updates/2.16.0--2.16.1.sql
46+
updates/2.16.1--2.17.0.sql)
4647

4748
# The downgrade file to generate a downgrade script for the current version, as
4849
# specified in version.config
49-
set(CURRENT_REV_FILE reverse-dev.sql)
50+
set(CURRENT_REV_FILE 2.17.0--2.16.1.sql)
5051
# Files for generating old downgrade scripts. This should only include files for
5152
# downgrade from one version to its previous version since we do not support
5253
# skipping versions when downgrading.
@@ -84,7 +85,8 @@ set(OLD_REV_FILES
8485
2.15.2--2.15.1.sql
8586
2.15.3--2.15.2.sql
8687
2.16.0--2.15.3.sql
87-
2.16.1--2.16.0.sql)
88+
2.16.1--2.16.0.sql
89+
2.17.0--2.16.1.sql)
8890

8991
set(MODULE_PATHNAME "$libdir/timescaledb-${PROJECT_VERSION_MOD}")
9092
set(LOADER_PATHNAME "$libdir/timescaledb")

sql/updates/2.16.1--2.17.0.sql

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CREATE FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data)
2+
RETURNS TABLE (algorithm name, has_nulls bool)
3+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
4+
LANGUAGE C STRICT IMMUTABLE SET search_path = pg_catalog, pg_temp;
5+
6+
CREATE INDEX compression_chunk_size_idx ON _timescaledb_catalog.compression_chunk_size (compressed_chunk_id);
7+
8+
CREATE FUNCTION _timescaledb_functions.drop_osm_chunk(hypertable REGCLASS)
9+
RETURNS BOOL
10+
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
11+
LANGUAGE C VOLATILE;

sql/updates/2.17.0--2.16.1.sql

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
-- check whether we can safely downgrade the existing compression setup
2+
CREATE OR REPLACE FUNCTION _timescaledb_functions.add_sequence_number_metadata_column(
3+
comp_ch_schema_name text,
4+
comp_ch_table_name text
5+
)
6+
RETURNS BOOL LANGUAGE PLPGSQL AS
7+
$BODY$
8+
DECLARE
9+
chunk_schema_name text;
10+
chunk_table_name text;
11+
index_name text;
12+
segmentby_columns text;
13+
BEGIN
14+
SELECT ch.schema_name, ch.table_name INTO STRICT chunk_schema_name, chunk_table_name
15+
FROM _timescaledb_catalog.chunk ch
16+
INNER JOIN _timescaledb_catalog.chunk comp_ch
17+
ON ch.compressed_chunk_id = comp_ch.id
18+
WHERE comp_ch.schema_name = comp_ch_schema_name
19+
AND comp_ch.table_name = comp_ch_table_name;
20+
21+
IF NOT FOUND THEN
22+
RAISE USING
23+
ERRCODE = 'feature_not_supported',
24+
MESSAGE = 'Cannot migrate compressed chunk to version 2.16.1, chunk not found';
25+
END IF;
26+
27+
-- Add sequence number column to compressed chunk
28+
EXECUTE format('ALTER TABLE %s.%s ADD COLUMN _ts_meta_sequence_num INT DEFAULT NULL', comp_ch_schema_name, comp_ch_table_name);
29+
30+
-- Remove all indexes from compressed chunk
31+
FOR index_name IN
32+
SELECT format('%s.%s', i.schemaname, i.indexname)
33+
FROM pg_indexes i
34+
WHERE i.schemaname = comp_ch_schema_name
35+
AND i.tablename = comp_ch_table_name
36+
LOOP
37+
EXECUTE format('DROP INDEX %s;', index_name);
38+
END LOOP;
39+
40+
-- Fetch the segmentby columns from compression settings
41+
SELECT string_agg(cs.segmentby_column, ',') INTO segmentby_columns
42+
FROM (
43+
SELECT unnest(segmentby)
44+
FROM _timescaledb_catalog.compression_settings
45+
WHERE relid = format('%s.%s', comp_ch_schema_name, comp_ch_table_name)::regclass::oid
46+
AND segmentby IS NOT NULL
47+
) AS cs(segmentby_column);
48+
49+
-- Create compressed chunk index based on sequence num metadata column
50+
-- If there is no segmentby columns, we can skip creating the index
51+
IF FOUND AND segmentby_columns IS NOT NULL THEN
52+
EXECUTE format('CREATE INDEX ON %s.%s (%s, _ts_meta_sequence_num);', comp_ch_schema_name, comp_ch_table_name, segmentby_columns);
53+
END IF;
54+
55+
-- Mark compressed chunk as unordered
56+
-- Marking the chunk status bit (2) makes it unordered
57+
-- and disables some optimizations. In order to re-enable
58+
-- them, you need to recompress these chunks.
59+
UPDATE _timescaledb_catalog.chunk
60+
SET status = status | 2 -- set unordered bit
61+
WHERE schema_name = chunk_schema_name
62+
AND table_name = chunk_table_name;
63+
64+
RETURN true;
65+
END
66+
$BODY$ SET search_path TO pg_catalog, pg_temp;
67+
68+
DO $$
69+
DECLARE
70+
chunk_count int;
71+
chunk_record record;
72+
BEGIN
73+
-- if we find chunks which don't have sequence number metadata column in
74+
-- compressed chunk, we need to stop downgrade and have the user run
75+
-- a migration script to re-add the missing columns
76+
SELECT count(*) INTO STRICT chunk_count
77+
FROM _timescaledb_catalog.chunk ch
78+
INNER JOIN _timescaledb_catalog.chunk uncomp_ch
79+
ON uncomp_ch.compressed_chunk_id = ch.id
80+
WHERE not exists (
81+
SELECT
82+
FROM pg_attribute att
83+
WHERE attrelid=format('%I.%I',ch.schema_name,ch.table_name)::regclass
84+
AND attname='_ts_meta_sequence_num')
85+
AND NOT uncomp_ch.dropped;
86+
87+
-- Doing the migration if we find 10 or less chunks that need to be migrated
88+
IF chunk_count > 10 THEN
89+
RAISE USING
90+
ERRCODE = 'feature_not_supported',
91+
MESSAGE = 'Cannot downgrade compressed hypertables with chunks that do not contain sequence numbers. Run timescaledb--2.17-2.16.1.sql migration script before downgrading.',
92+
DETAIL = 'Number of chunks that need to be migrated: '|| chunk_count::text;
93+
ELSIF chunk_count > 0 THEN
94+
FOR chunk_record IN
95+
SELECT comp_ch.*
96+
FROM _timescaledb_catalog.chunk ch
97+
INNER JOIN _timescaledb_catalog.chunk comp_ch
98+
ON ch.compressed_chunk_id = comp_ch.id
99+
WHERE not exists (
100+
SELECT
101+
FROM pg_attribute att
102+
WHERE attrelid=format('%I.%I',comp_ch.schema_name,comp_ch.table_name)::regclass
103+
AND attname='_ts_meta_sequence_num')
104+
AND NOT ch.dropped
105+
LOOP
106+
PERFORM _timescaledb_functions.add_sequence_number_metadata_column(chunk_record.schema_name, chunk_record.table_name);
107+
RAISE LOG 'Migrated compressed chunk %s.%s to version 2.16.1', chunk_record.schema_name, chunk_record.table_name;
108+
END LOOP;
109+
110+
RAISE LOG 'Migration successful!';
111+
END IF;
112+
END
113+
$$;
114+
115+
DROP FUNCTION _timescaledb_functions.add_sequence_number_metadata_column(text, text);
116+
117+
DROP FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data);
118+
DROP INDEX _timescaledb_catalog.compression_chunk_size_idx;
119+
DROP FUNCTION IF EXISTS _timescaledb_functions.drop_osm_chunk(REGCLASS);

sql/updates/latest-dev.sql

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +0,0 @@
1-
CREATE FUNCTION _timescaledb_functions.compressed_data_info(_timescaledb_internal.compressed_data)
2-
RETURNS TABLE (algorithm name, has_nulls bool)
3-
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
4-
LANGUAGE C STRICT IMMUTABLE SET search_path = pg_catalog, pg_temp;
5-
6-
CREATE INDEX compression_chunk_size_idx ON _timescaledb_catalog.compression_chunk_size (compressed_chunk_id);
7-
8-
CREATE FUNCTION _timescaledb_functions.drop_osm_chunk(hypertable REGCLASS)
9-
RETURNS BOOL
10-
AS '@MODULE_PATHNAME@', 'ts_update_placeholder'
11-
LANGUAGE C VOLATILE;

0 commit comments

Comments
 (0)