Skip to content

Commit e4eb666

Browse files
committed
Release 2.16.0
This release contains significant performance improvements when working with compressed data, extended join support in continuous aggregates, and the ability to define foreign keys from regular tables towards hypertables. We recommend that you upgrade at the next available opportunity. In TimescaleDB v2.16.0 we: * Introduce multiple performance focused optimizations for data manipulation operations (DML) over compressed chunks. Improved upsert performance by more than 100x in some cases and more than 1000x in some update/delete scenarios. * Add the ability to define chunk skipping indexes on non-partitioning columns of compressed hypertables TimescaleDB v2.16.0 extends chunk exclusion to use those skipping (sparse) indexes when queries filter on the relevant columns, and prune chunks that do not include any relevant data for calculating the query response. * Offer new options for use cases that require foreign keys defined. You can now add foreign keys from regular tables towards hypertables. We have also removed some really annoying locks in the reverse direction that blocked access to referenced tables while compression was running. * Extend Continuous Aggregates to support more types of analytical queries. More types of joins are supported, additional equality operators on join clauses, and support for joins between multiple regular tables. **Highlighted features in this release** * Improved query performance through chunk exclusion on compressed hypertables. You can now define chunk skipping indexes on compressed chunks for any column with one of the following integer data types: `smallint`, `int`, `bigint`, `serial`, `bigserial`, `date`, `timestamp`, `timestamptz`. After you call `enable_chunk_skipping` on a column, TimescaleDB tracks the min and max values for that column. TimescaleDB uses that information to exclude chunks for queries that filter on that column, and would not find any data in those chunks. * Improved upsert performance on compressed hypertables. By using index scans to verify constraints during inserts on compressed chunks, TimescaleDB speeds up some ON CONFLICT clauses by more than 100x. * Improved performance of updates, deletes, and inserts on compressed hypertables. By filtering data while accessing the compressed data and before decompressing, TimescaleDB has improved performance for updates and deletes on all types of compressed chunks, as well as inserts into compressed chunks with unique constraints. By signaling constraint violations without decompressing, or decompressing only when matching records are found in the case of updates, deletes and upserts, TimescaleDB v2.16.0 speeds up those operations more than 1000x in some update/delete scenarios, and 10x for upserts. * You can add foreign keys from regular tables to hypertables, with support for all types of cascading options. This is useful for hypertables that partition using sequential IDs, and need to reference those IDs from other tables. * Lower locking requirements during compression for hypertables with foreign keys Advanced foreign key handling removes the need for locking referenced tables when new chunks are compressed. DML is no longer blocked on referenced tables while compression runs on a hypertable. * Improved support for queries on Continuous Aggregates `INNER/LEFT` and `LATERAL` joins are now supported. Plus, you can now join with multiple regular tables, and you can have more than one equality operator on join clauses. **PostgreSQL 13 support removal announcement** Following the deprecation announcement for PostgreSQL 13 in TimescaleDB v2.13, PostgreSQL 13 is no longer supported in TimescaleDB v2.16. The Currently supported PostgreSQL major versions are 14, 15 and 16.
1 parent 01b5de5 commit e4eb666

26 files changed

+193
-111
lines changed

.unreleased/fix_7055

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

.unreleased/fix_7064

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

.unreleased/fix_7074

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

.unreleased/pr_6880

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

.unreleased/pr_6895

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

.unreleased/pr_6897

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

.unreleased/pr_6918

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

.unreleased/pr_6920

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

.unreleased/pr_6987

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

.unreleased/pr_6989

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

.unreleased/pr_7018

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

.unreleased/pr_7020

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

.unreleased/pr_7046

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

.unreleased/pr_7048

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

.unreleased/pr_7069

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

.unreleased/pr_7075

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

.unreleased/pr_7101

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

.unreleased/pr_7108

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

.unreleased/pr_7116

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

.unreleased/pr_7134

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

.unreleased/pr_7161

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

CHANGELOG.md

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

7+
## 2.16.0 (2024-07-31)
8+
9+
This release contains significant performance improvements when working with compressed data, extended join
10+
support in continuous aggregates, and the ability to define foreign keys from regular tables towards hypertables.
11+
We recommend that you upgrade at the next available opportunity.
12+
13+
In TimescaleDB v2.16.0 we:
14+
15+
* Introduce multiple performance focused optimizations for data manipulation operations (DML) over compressed chunks.
16+
17+
Improved upsert performance by more than 100x in some cases and more than 1000x in some update/delete scenarios.
18+
19+
* Add the ability to define chunk skipping indexes on non-partitioning columns of compressed hypertables
20+
21+
TimescaleDB v2.16.0 extends chunk exclusion to use those skipping (sparse) indexes when queries filter on the relevant columns,
22+
and prune chunks that do not include any relevant data for calculating the query response.
23+
24+
* Offer new options for use cases that require foreign keys defined.
25+
26+
You can now add foreign keys from regular tables towards hypertables. We have also removed
27+
some really annoying locks in the reverse direction that blocked access to referenced tables
28+
while compression was running.
29+
30+
* Extend Continuous Aggregates to support more types of analytical queries.
31+
32+
More types of joins are supported, additional equality operators on join clauses, and
33+
support for joins between multiple regular tables.
34+
35+
**Highlighted features in this release**
36+
37+
* Improved query performance through chunk exclusion on compressed hypertables.
38+
39+
You can now define chunk skipping indexes on compressed chunks for any column with one of the following
40+
integer data types: `smallint`, `int`, `bigint`, `serial`, `bigserial`, `date`, `timestamp`, `timestamptz`.
41+
42+
After you call `enable_chunk_skipping` on a column, TimescaleDB tracks the min and max values for
43+
that column. TimescaleDB uses that information to exclude chunks for queries that filter on that
44+
column, and would not find any data in those chunks.
45+
46+
* Improved upsert performance on compressed hypertables.
47+
48+
By using index scans to verify constraints during inserts on compressed chunks, TimescaleDB speeds
49+
up some ON CONFLICT clauses by more than 100x.
50+
51+
* Improved performance of updates, deletes, and inserts on compressed hypertables.
52+
53+
By filtering data while accessing the compressed data and before decompressing, TimescaleDB has
54+
improved performance for updates and deletes on all types of compressed chunks, as well as inserts
55+
into compressed chunks with unique constraints.
56+
57+
By signaling constraint violations without decompressing, or decompressing only when matching
58+
records are found in the case of updates, deletes and upserts, TimescaleDB v2.16.0 speeds
59+
up those operations more than 1000x in some update/delete scenarios, and 10x for upserts.
60+
61+
* You can add foreign keys from regular tables to hypertables, with support for all types of cascading options.
62+
This is useful for hypertables that partition using sequential IDs, and need to reference those IDs from other tables.
63+
64+
* Lower locking requirements during compression for hypertables with foreign keys
65+
66+
Advanced foreign key handling removes the need for locking referenced tables when new chunks are compressed.
67+
DML is no longer blocked on referenced tables while compression runs on a hypertable.
68+
69+
* Improved support for queries on Continuous Aggregates
70+
71+
`INNER/LEFT` and `LATERAL` joins are now supported. Plus, you can now join with multiple regular tables,
72+
and you can have more than one equality operator on join clauses.
73+
74+
**PostgreSQL 13 support removal announcement**
75+
76+
Following the deprecation announcement for PostgreSQL 13 in TimescaleDB v2.13,
77+
PostgreSQL 13 is no longer supported in TimescaleDB v2.16.
78+
79+
The Currently supported PostgreSQL major versions are 14, 15 and 16.
80+
81+
**Features**
82+
* #6880: Add support for the array operators used for compressed DML batch filtering.
83+
* #6895: Improve the compressed DML expression pushdown.
84+
* #6897: Add support for replica identity on compressed hypertables.
85+
* #6918: Remove support for PG13.
86+
* #6920: Rework compression activity wal markers.
87+
* #6989: Add support for foreign keys when converting plain tables to hypertables.
88+
* #7020: Add support for the chunk column statistics tracking.
89+
* #7048: Add an index scan for INSERT DML decompression.
90+
* #7075: Reduce decompression on the compressed INSERT.
91+
* #7101: Reduce decompressions for the compressed UPDATE/DELETE.
92+
* #7108 Reduce decompressions for INSERTs with UNIQUE constraints
93+
* #7116 Use DELETE instead of TRUNCATE after compression
94+
* #7134 Refactor foreign key handling for compressed hypertables
95+
* #7161 Fix `mergejoin input data is out of order`
96+
97+
**Bugfixes**
98+
* #6987 Fix REASSIGN OWNED BY for background jobs
99+
* #7018: Fix `search_path` quoting in the compression defaults function.
100+
* #7046: Prevent locking for compressed tuples.
101+
* #7055: Fix the `scankey` for `segment by` columns, where the type `constant` is different to `variable`.
102+
* #7064: Fix the bug in the default `order by` calculation in compression.
103+
* #7069: Fix the index column name usage.
104+
* #7074: Fix the bug in the default `segment by` calculation in compression.
105+
106+
**Thanks**
107+
* @jledentu For reporting a problem with mergejoin input order
108+
109+
7110
## 2.15.3 (2024-07-02)
8111

9112
This release contains bug fixes since the 2.15.2 release.

sql/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ set(MOD_FILES
4040
updates/2.14.2--2.15.0.sql
4141
updates/2.15.0--2.15.1.sql
4242
updates/2.15.1--2.15.2.sql
43-
updates/2.15.2--2.15.3.sql)
43+
updates/2.15.2--2.15.3.sql
44+
updates/2.15.3--2.16.0.sql)
4445

4546
# The downgrade file to generate a downgrade script for the current version, as
4647
# specified in version.config

sql/updates/2.15.3--2.16.0.sql

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
-- Enable tracking of statistics on a column of a hypertable.
2+
--
3+
-- hypertable - OID of the table to which the column belongs to
4+
-- column_name - The column to track statistics for
5+
-- if_not_exists - If set, and the entry already exists, generate a notice instead of an error
6+
CREATE FUNCTION @[email protected]_chunk_skipping(
7+
hypertable REGCLASS,
8+
column_name NAME,
9+
if_not_exists BOOLEAN = FALSE
10+
) RETURNS TABLE(column_stats_id INT, enabled BOOL)
11+
AS 'SELECT NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp;
12+
13+
-- Disable tracking of statistics on a column of a hypertable.
14+
--
15+
-- hypertable - OID of the table to remove from
16+
-- column_name - NAME of the column on which the stats are tracked
17+
-- if_not_exists - If set, and the entry does not exist,
18+
-- generate a notice instead of an error
19+
CREATE FUNCTION @[email protected]_chunk_skipping(
20+
hypertable REGCLASS,
21+
column_name NAME,
22+
if_not_exists BOOLEAN = FALSE
23+
) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL)
24+
AS 'SELECT NULL,NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp;
25+
26+
-- Track statistics for columns of chunks from a hypertable.
27+
-- Currently, we track the min/max range for a given column across chunks.
28+
-- More statistics (like bloom filters) will be added in the future.
29+
--
30+
-- A "special" entry for a column with invalid chunk_id, PG_INT64_MAX,
31+
-- PG_INT64_MIN indicates that min/max ranges could be computed for this column
32+
-- for chunks.
33+
--
34+
-- The ranges can overlap across chunks. The values could be out-of-date if
35+
-- modifications/changes occur in the corresponding chunk and such entries
36+
-- should be marked as "invalid" to ensure that the chunk is in
37+
-- appropriate state to be able to use these values. Thus these entries
38+
-- are different from dimension_slice which is used for tracking partitioning
39+
-- column ranges which have different characteristics.
40+
--
41+
-- Currently this catalog supports datatypes like INT, SERIAL, BIGSERIAL,
42+
-- DATE, TIMESTAMP etc. by storing the ranges in bigint columns. In the
43+
-- future, we could support additional datatypes (which support btree style
44+
-- >, <, = comparators) by storing their textual representation.
45+
--
46+
CREATE TABLE _timescaledb_catalog.chunk_column_stats (
47+
id serial NOT NULL,
48+
hypertable_id integer NOT NULL,
49+
chunk_id integer NOT NULL,
50+
column_name name NOT NULL,
51+
range_start bigint NOT NULL,
52+
range_end bigint NOT NULL,
53+
valid boolean NOT NULL,
54+
-- table constraints
55+
CONSTRAINT chunk_column_stats_pkey PRIMARY KEY (id),
56+
CONSTRAINT chunk_column_stats_ht_id_chunk_id_colname_key UNIQUE (hypertable_id, chunk_id, column_name),
57+
CONSTRAINT chunk_column_stats_range_check CHECK (range_start <= range_end),
58+
CONSTRAINT chunk_column_stats_hypertable_id_fkey FOREIGN KEY (hypertable_id) REFERENCES _timescaledb_catalog.hypertable (id),
59+
CONSTRAINT chunk_column_stats_chunk_id_fkey FOREIGN KEY (chunk_id) REFERENCES _timescaledb_catalog.chunk (id)
60+
);
61+
62+
SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.chunk_column_stats', '');
63+
64+
SELECT pg_catalog.pg_extension_config_dump(pg_get_serial_sequence('_timescaledb_catalog.chunk_column_stats', 'id'), '');
65+
66+
GRANT SELECT ON _timescaledb_catalog.chunk_column_stats TO PUBLIC;
67+
GRANT SELECT ON _timescaledb_catalog.chunk_column_stats_id_seq TO PUBLIC;
68+
69+
-- Remove foreign key constraints from compressed chunks
70+
DO $$
71+
DECLARE
72+
conrelid regclass;
73+
conname name;
74+
BEGIN
75+
FOR conrelid, conname IN
76+
SELECT
77+
con.conrelid::regclass,
78+
con.conname
79+
FROM _timescaledb_catalog.chunk ch
80+
JOIN pg_constraint con ON con.conrelid = format('%I.%I',schema_name,table_name)::regclass AND con.contype='f'
81+
WHERE NOT ch.dropped AND EXISTS(SELECT FROM _timescaledb_catalog.chunk ch2 WHERE NOT ch2.dropped AND ch2.compressed_chunk_id=ch.id)
82+
LOOP
83+
EXECUTE format('ALTER TABLE %s DROP CONSTRAINT %I', conrelid, conname);
84+
END LOOP;
85+
END $$;
86+

sql/updates/latest-dev.sql

Lines changed: 0 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,86 +0,0 @@
1-
-- Enable tracking of statistics on a column of a hypertable.
2-
--
3-
-- hypertable - OID of the table to which the column belongs to
4-
-- column_name - The column to track statistics for
5-
-- if_not_exists - If set, and the entry already exists, generate a notice instead of an error
6-
CREATE FUNCTION @[email protected]_chunk_skipping(
7-
hypertable REGCLASS,
8-
column_name NAME,
9-
if_not_exists BOOLEAN = FALSE
10-
) RETURNS TABLE(column_stats_id INT, enabled BOOL)
11-
AS 'SELECT NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp;
12-
13-
-- Disable tracking of statistics on a column of a hypertable.
14-
--
15-
-- hypertable - OID of the table to remove from
16-
-- column_name - NAME of the column on which the stats are tracked
17-
-- if_not_exists - If set, and the entry does not exist,
18-
-- generate a notice instead of an error
19-
CREATE FUNCTION @[email protected]_chunk_skipping(
20-
hypertable REGCLASS,
21-
column_name NAME,
22-
if_not_exists BOOLEAN = FALSE
23-
) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL)
24-
AS 'SELECT NULL,NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp;
25-
26-
-- Track statistics for columns of chunks from a hypertable.
27-
-- Currently, we track the min/max range for a given column across chunks.
28-
-- More statistics (like bloom filters) will be added in the future.
29-
--
30-
-- A "special" entry for a column with invalid chunk_id, PG_INT64_MAX,
31-
-- PG_INT64_MIN indicates that min/max ranges could be computed for this column
32-
-- for chunks.
33-
--
34-
-- The ranges can overlap across chunks. The values could be out-of-date if
35-
-- modifications/changes occur in the corresponding chunk and such entries
36-
-- should be marked as "invalid" to ensure that the chunk is in
37-
-- appropriate state to be able to use these values. Thus these entries
38-
-- are different from dimension_slice which is used for tracking partitioning
39-
-- column ranges which have different characteristics.
40-
--
41-
-- Currently this catalog supports datatypes like INT, SERIAL, BIGSERIAL,
42-
-- DATE, TIMESTAMP etc. by storing the ranges in bigint columns. In the
43-
-- future, we could support additional datatypes (which support btree style
44-
-- >, <, = comparators) by storing their textual representation.
45-
--
46-
CREATE TABLE _timescaledb_catalog.chunk_column_stats (
47-
id serial NOT NULL,
48-
hypertable_id integer NOT NULL,
49-
chunk_id integer NOT NULL,
50-
column_name name NOT NULL,
51-
range_start bigint NOT NULL,
52-
range_end bigint NOT NULL,
53-
valid boolean NOT NULL,
54-
-- table constraints
55-
CONSTRAINT chunk_column_stats_pkey PRIMARY KEY (id),
56-
CONSTRAINT chunk_column_stats_ht_id_chunk_id_colname_key UNIQUE (hypertable_id, chunk_id, column_name),
57-
CONSTRAINT chunk_column_stats_range_check CHECK (range_start <= range_end),
58-
CONSTRAINT chunk_column_stats_hypertable_id_fkey FOREIGN KEY (hypertable_id) REFERENCES _timescaledb_catalog.hypertable (id),
59-
CONSTRAINT chunk_column_stats_chunk_id_fkey FOREIGN KEY (chunk_id) REFERENCES _timescaledb_catalog.chunk (id)
60-
);
61-
62-
SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.chunk_column_stats', '');
63-
64-
SELECT pg_catalog.pg_extension_config_dump(pg_get_serial_sequence('_timescaledb_catalog.chunk_column_stats', 'id'), '');
65-
66-
GRANT SELECT ON _timescaledb_catalog.chunk_column_stats TO PUBLIC;
67-
GRANT SELECT ON _timescaledb_catalog.chunk_column_stats_id_seq TO PUBLIC;
68-
69-
-- Remove foreign key constraints from compressed chunks
70-
DO $$
71-
DECLARE
72-
conrelid regclass;
73-
conname name;
74-
BEGIN
75-
FOR conrelid, conname IN
76-
SELECT
77-
con.conrelid::regclass,
78-
con.conname
79-
FROM _timescaledb_catalog.chunk ch
80-
JOIN pg_constraint con ON con.conrelid = format('%I.%I',schema_name,table_name)::regclass AND con.contype='f'
81-
WHERE NOT ch.dropped AND EXISTS(SELECT FROM _timescaledb_catalog.chunk ch2 WHERE NOT ch2.dropped AND ch2.compressed_chunk_id=ch.id)
82-
LOOP
83-
EXECUTE format('ALTER TABLE %s DROP CONSTRAINT %I', conrelid, conname);
84-
END LOOP;
85-
END $$;
86-

version.config

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = 2.16.0-dev
2-
update_from_version = 2.15.3
1+
version = 2.17.0-dev
2+
update_from_version = 2.16.0
33
downgrade_to_version = 2.15.3

0 commit comments

Comments
 (0)