From f492bd192a27878f1ae65241a18e61a0268bd870 Mon Sep 17 00:00:00 2001 From: Pallavi Sontakke Date: Thu, 18 Jul 2024 18:06:56 +0530 Subject: [PATCH] ## 2.16.0 This release contains performance improvements and bug fixes since the 2.15.3 release. We recommend that you upgrade at the next available opportunity. **Features** * #6880: Add support for the array operators used for compressed DML batch filtering. * #6895: Improve the compressed DML expression pushdown. * #6897: Add support for replica identity on compressed hypertables. * #6918: Remove support for PG13. * #6920: Rework compression activity wal markers. * #6989: Add support for foreign keys when converting plain tables to hypertables. * #7020: Add support for the chunk column statistics tracking. * #7048: Add an index scan for INSERT DML decompression. * #7075: Reduce decompression on the compressed INSERT. * #7101: Reduce decompressions for the compressed UPDATE/DELETE. * #7108 Reduce decompressions for INSERTs with UNIQUE constraints **Bugfixes** * #7018: Fix `search_path` quoting in the compression defaults function. * #7046: Prevent locking for compressed tuples. * #7055: Fix the `scankey` for `segment by` columns, where the type `constant` is different to `variable`. * #7064: Fix the bug in the default `order by` calculation in compression. * #7069: Fix the index column name usage. * #7074: Fix the bug in the default `segment by` calculation in compression. **Thanks** --- .unreleased/fix_7055 | 1 - .unreleased/fix_7064 | 1 - .unreleased/fix_7074 | 1 - .unreleased/pr_6880 | 1 - .unreleased/pr_6895 | 1 - .unreleased/pr_6897 | 1 - .unreleased/pr_6918 | 1 - .unreleased/pr_6920 | 1 - .unreleased/pr_6989 | 1 - .unreleased/pr_7018 | 1 - .unreleased/pr_7020 | 1 - .unreleased/pr_7046 | 1 - .unreleased/pr_7048 | 1 - .unreleased/pr_7069 | 1 - .unreleased/pr_7075 | 1 - .unreleased/pr_7101 | 1 - .unreleased/pr_7108 | 1 - CHANGELOG.md | 31 ++++++++++++++++ sql/CMakeLists.txt | 8 ++-- sql/updates/2.15.3--2.16.0.sql | 67 ++++++++++++++++++++++++++++++++++ sql/updates/2.16.0--2.15.3.sql | 7 ++++ sql/updates/latest-dev.sql | 67 ---------------------------------- sql/updates/reverse-dev.sql | 7 ---- version.config | 2 +- 24 files changed, 111 insertions(+), 95 deletions(-) delete mode 100644 .unreleased/fix_7055 delete mode 100644 .unreleased/fix_7064 delete mode 100644 .unreleased/fix_7074 delete mode 100644 .unreleased/pr_6880 delete mode 100644 .unreleased/pr_6895 delete mode 100644 .unreleased/pr_6897 delete mode 100644 .unreleased/pr_6918 delete mode 100644 .unreleased/pr_6920 delete mode 100644 .unreleased/pr_6989 delete mode 100644 .unreleased/pr_7018 delete mode 100644 .unreleased/pr_7020 delete mode 100644 .unreleased/pr_7046 delete mode 100644 .unreleased/pr_7048 delete mode 100644 .unreleased/pr_7069 delete mode 100644 .unreleased/pr_7075 delete mode 100644 .unreleased/pr_7101 delete mode 100644 .unreleased/pr_7108 create mode 100644 sql/updates/2.15.3--2.16.0.sql create mode 100644 sql/updates/2.16.0--2.15.3.sql diff --git a/.unreleased/fix_7055 b/.unreleased/fix_7055 deleted file mode 100644 index 960fe145c1d..00000000000 --- a/.unreleased/fix_7055 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7055: Fix the `scankey` for `segment by` columns, where the type `constant` is different to `variable`. diff --git a/.unreleased/fix_7064 b/.unreleased/fix_7064 deleted file mode 100644 index e953278871e..00000000000 --- a/.unreleased/fix_7064 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7064: Fix the bug in the default `order by` calculation in compression. diff --git a/.unreleased/fix_7074 b/.unreleased/fix_7074 deleted file mode 100644 index 08e9b80660f..00000000000 --- a/.unreleased/fix_7074 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7074: Fix the bug in the default `segment by` calculation in compression. diff --git a/.unreleased/pr_6880 b/.unreleased/pr_6880 deleted file mode 100644 index b7cfc9250b4..00000000000 --- a/.unreleased/pr_6880 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6880: Add support for the array operators used for compressed DML batch filtering. diff --git a/.unreleased/pr_6895 b/.unreleased/pr_6895 deleted file mode 100644 index 27f6bcbd43b..00000000000 --- a/.unreleased/pr_6895 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6895: Improve the compressed DML expression pushdown. diff --git a/.unreleased/pr_6897 b/.unreleased/pr_6897 deleted file mode 100644 index 3a0f0f044fd..00000000000 --- a/.unreleased/pr_6897 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6897: Add support for replica identity on compressed hypertables. diff --git a/.unreleased/pr_6918 b/.unreleased/pr_6918 deleted file mode 100644 index 3096a1a44bc..00000000000 --- a/.unreleased/pr_6918 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6918: Remove support for PG13. diff --git a/.unreleased/pr_6920 b/.unreleased/pr_6920 deleted file mode 100644 index 4926746b5e2..00000000000 --- a/.unreleased/pr_6920 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6920: Rework compression activity wal markers. diff --git a/.unreleased/pr_6989 b/.unreleased/pr_6989 deleted file mode 100644 index df3fd616208..00000000000 --- a/.unreleased/pr_6989 +++ /dev/null @@ -1 +0,0 @@ -Implements: #6989: Add support for foreign keys when converting plain tables to hypertables. diff --git a/.unreleased/pr_7018 b/.unreleased/pr_7018 deleted file mode 100644 index 87e2d2ad256..00000000000 --- a/.unreleased/pr_7018 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7018: Fix `search_path` quoting in the compression defaults function. diff --git a/.unreleased/pr_7020 b/.unreleased/pr_7020 deleted file mode 100644 index cb815597b0b..00000000000 --- a/.unreleased/pr_7020 +++ /dev/null @@ -1 +0,0 @@ -Implements: #7020: Add support for the chunk column statistics tracking. diff --git a/.unreleased/pr_7046 b/.unreleased/pr_7046 deleted file mode 100644 index a6779d078b0..00000000000 --- a/.unreleased/pr_7046 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7046: Prevent locking for compressed tuples. diff --git a/.unreleased/pr_7048 b/.unreleased/pr_7048 deleted file mode 100644 index 533ef42d6a6..00000000000 --- a/.unreleased/pr_7048 +++ /dev/null @@ -1 +0,0 @@ -Implements: #7048: Add an index scan for INSERT DML decompression. diff --git a/.unreleased/pr_7069 b/.unreleased/pr_7069 deleted file mode 100644 index 813d9ffd579..00000000000 --- a/.unreleased/pr_7069 +++ /dev/null @@ -1 +0,0 @@ -Fixes: #7069: Fix the index column name usage. diff --git a/.unreleased/pr_7075 b/.unreleased/pr_7075 deleted file mode 100644 index 02f9298df15..00000000000 --- a/.unreleased/pr_7075 +++ /dev/null @@ -1 +0,0 @@ -Implements: #7075: Reduce decompression on the compressed INSERT. diff --git a/.unreleased/pr_7101 b/.unreleased/pr_7101 deleted file mode 100644 index 4623adcdc39..00000000000 --- a/.unreleased/pr_7101 +++ /dev/null @@ -1 +0,0 @@ -Implements: #7101: Reduce decompressions for the compressed UPDATE/DELETE. diff --git a/.unreleased/pr_7108 b/.unreleased/pr_7108 deleted file mode 100644 index a76c02ca9e4..00000000000 --- a/.unreleased/pr_7108 +++ /dev/null @@ -1 +0,0 @@ -Implements: #7108 Reduce decompressions for INSERTs with UNIQUE constraints diff --git a/CHANGELOG.md b/CHANGELOG.md index 149f7ea90a0..897f2ba84de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,37 @@ `psql` with the `-X` flag to prevent any `.psqlrc` commands from accidentally triggering the load of a previous DB version.** + +## 2.16.0 (2024-07-18) + +This release contains performance improvements and bug fixes since +the 2.15.3 release. We recommend that you upgrade at the next +available opportunity. + + +**Features** +* #6880: Add support for the array operators used for compressed DML batch filtering. +* #6895: Improve the compressed DML expression pushdown. +* #6897: Add support for replica identity on compressed hypertables. +* #6918: Remove support for PG13. +* #6920: Rework compression activity wal markers. +* #6989: Add support for foreign keys when converting plain tables to hypertables. +* #7020: Add support for the chunk column statistics tracking. +* #7048: Add an index scan for INSERT DML decompression. +* #7075: Reduce decompression on the compressed INSERT. +* #7101: Reduce decompressions for the compressed UPDATE/DELETE. +* #7108 Reduce decompressions for INSERTs with UNIQUE constraints + +**Bugfixes** +* #7018: Fix `search_path` quoting in the compression defaults function. +* #7046: Prevent locking for compressed tuples. +* #7055: Fix the `scankey` for `segment by` columns, where the type `constant` is different to `variable`. +* #7064: Fix the bug in the default `order by` calculation in compression. +* #7069: Fix the index column name usage. +* #7074: Fix the bug in the default `segment by` calculation in compression. + +**Thanks** + ## 2.15.3 (2024-07-02) This release contains bug fixes since the 2.15.2 release. diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 0d7aab1522f..69fea612a0f 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -40,11 +40,12 @@ set(MOD_FILES updates/2.14.2--2.15.0.sql updates/2.15.0--2.15.1.sql updates/2.15.1--2.15.2.sql - updates/2.15.2--2.15.3.sql) + updates/2.15.2--2.15.3.sql + updates/2.15.3--2.16.0.sql) # The downgrade file to generate a downgrade script for the current version, as # specified in version.config -set(CURRENT_REV_FILE reverse-dev.sql) +set(CURRENT_REV_FILE 2.16.0--2.15.3.sql) # Files for generating old downgrade scripts. This should only include files for # downgrade from one version to its previous version since we do not support # skipping versions when downgrading. @@ -80,7 +81,8 @@ set(OLD_REV_FILES 2.15.0--2.14.2.sql 2.15.1--2.15.0.sql 2.15.2--2.15.1.sql - 2.15.3--2.15.2.sql) + 2.15.3--2.15.2.sql + 2.16.0--2.15.3.sql) set(MODULE_PATHNAME "$libdir/timescaledb-${PROJECT_VERSION_MOD}") set(LOADER_PATHNAME "$libdir/timescaledb") diff --git a/sql/updates/2.15.3--2.16.0.sql b/sql/updates/2.15.3--2.16.0.sql new file mode 100644 index 00000000000..42f8bf0d737 --- /dev/null +++ b/sql/updates/2.15.3--2.16.0.sql @@ -0,0 +1,67 @@ +-- Enable tracking of statistics on a column of a hypertable. +-- +-- hypertable - OID of the table to which the column belongs to +-- column_name - The column to track statistics for +-- if_not_exists - If set, and the entry already exists, generate a notice instead of an error +CREATE FUNCTION @extschema@.enable_column_stats( + hypertable REGCLASS, + column_name NAME, + if_not_exists BOOLEAN = FALSE +) RETURNS TABLE(column_stats_id INT, enabled BOOL) +AS '@MODULE_PATHNAME@', 'ts_chunk_column_stats_enable' LANGUAGE C VOLATILE; + +-- Disable tracking of statistics on a column of a hypertable. +-- +-- hypertable - OID of the table to remove from +-- column_name - NAME of the column on which the stats are tracked +-- if_not_exists - If set, and the entry does not exist, +-- generate a notice instead of an error +CREATE FUNCTION @extschema@.disable_column_stats( + hypertable REGCLASS, + column_name NAME, + if_not_exists BOOLEAN = FALSE +) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL) +AS '@MODULE_PATHNAME@', 'ts_chunk_column_stats_disable' LANGUAGE C VOLATILE; + +-- Track statistics for columns of chunks from a hypertable. +-- Currently, we track the min/max range for a given column across chunks. +-- More statistics (like bloom filters) will be added in the future. +-- +-- A "special" entry for a column with invalid chunk_id, PG_INT64_MAX, +-- PG_INT64_MIN indicates that min/max ranges could be computed for this column +-- for chunks. +-- +-- The ranges can overlap across chunks. The values could be out-of-date if +-- modifications/changes occur in the corresponding chunk and such entries +-- should be marked as "invalid" to ensure that the chunk is in +-- appropriate state to be able to use these values. Thus these entries +-- are different from dimension_slice which is used for tracking partitioning +-- column ranges which have different characteristics. +-- +-- Currently this catalog supports datatypes like INT, SERIAL, BIGSERIAL, +-- DATE, TIMESTAMP etc. by storing the ranges in bigint columns. In the +-- future, we could support additional datatypes (which support btree style +-- >, <, = comparators) by storing their textual representation. +-- +CREATE TABLE _timescaledb_catalog.chunk_column_stats ( + id serial NOT NULL, + hypertable_id integer NOT NULL, + chunk_id integer NOT NULL, + column_name name NOT NULL, + range_start bigint NOT NULL, + range_end bigint NOT NULL, + valid boolean NOT NULL, + -- table constraints + CONSTRAINT chunk_column_stats_pkey PRIMARY KEY (id), + CONSTRAINT chunk_column_stats_ht_id_chunk_id_colname_key UNIQUE (hypertable_id, chunk_id, column_name), + CONSTRAINT chunk_column_stats_range_check CHECK (range_start <= range_end), + CONSTRAINT chunk_column_stats_hypertable_id_fkey FOREIGN KEY (hypertable_id) REFERENCES _timescaledb_catalog.hypertable (id), + CONSTRAINT chunk_column_stats_chunk_id_fkey FOREIGN KEY (chunk_id) REFERENCES _timescaledb_catalog.chunk (id) +); + +SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.chunk_column_stats', ''); + +SELECT pg_catalog.pg_extension_config_dump(pg_get_serial_sequence('_timescaledb_catalog.chunk_column_stats', 'id'), ''); + +GRANT SELECT ON _timescaledb_catalog.chunk_column_stats TO PUBLIC; +GRANT SELECT ON _timescaledb_catalog.chunk_column_stats_id_seq TO PUBLIC; diff --git a/sql/updates/2.16.0--2.15.3.sql b/sql/updates/2.16.0--2.15.3.sql new file mode 100644 index 00000000000..4096ae8198e --- /dev/null +++ b/sql/updates/2.16.0--2.15.3.sql @@ -0,0 +1,7 @@ +DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER); +-- remove chunk column statistics related objects +DROP FUNCTION IF EXISTS @extschema@.enable_column_stats(REGCLASS, NAME, BOOLEAN); +DROP FUNCTION IF EXISTS @extschema@.disable_column_stats(REGCLASS, NAME, BOOLEAN); +ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.chunk_column_stats; +ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.chunk_column_stats_id_seq; +DROP TABLE IF EXISTS _timescaledb_catalog.chunk_column_stats; diff --git a/sql/updates/latest-dev.sql b/sql/updates/latest-dev.sql index 42f8bf0d737..e69de29bb2d 100644 --- a/sql/updates/latest-dev.sql +++ b/sql/updates/latest-dev.sql @@ -1,67 +0,0 @@ --- Enable tracking of statistics on a column of a hypertable. --- --- hypertable - OID of the table to which the column belongs to --- column_name - The column to track statistics for --- if_not_exists - If set, and the entry already exists, generate a notice instead of an error -CREATE FUNCTION @extschema@.enable_column_stats( - hypertable REGCLASS, - column_name NAME, - if_not_exists BOOLEAN = FALSE -) RETURNS TABLE(column_stats_id INT, enabled BOOL) -AS '@MODULE_PATHNAME@', 'ts_chunk_column_stats_enable' LANGUAGE C VOLATILE; - --- Disable tracking of statistics on a column of a hypertable. --- --- hypertable - OID of the table to remove from --- column_name - NAME of the column on which the stats are tracked --- if_not_exists - If set, and the entry does not exist, --- generate a notice instead of an error -CREATE FUNCTION @extschema@.disable_column_stats( - hypertable REGCLASS, - column_name NAME, - if_not_exists BOOLEAN = FALSE -) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL) -AS '@MODULE_PATHNAME@', 'ts_chunk_column_stats_disable' LANGUAGE C VOLATILE; - --- Track statistics for columns of chunks from a hypertable. --- Currently, we track the min/max range for a given column across chunks. --- More statistics (like bloom filters) will be added in the future. --- --- A "special" entry for a column with invalid chunk_id, PG_INT64_MAX, --- PG_INT64_MIN indicates that min/max ranges could be computed for this column --- for chunks. --- --- The ranges can overlap across chunks. The values could be out-of-date if --- modifications/changes occur in the corresponding chunk and such entries --- should be marked as "invalid" to ensure that the chunk is in --- appropriate state to be able to use these values. Thus these entries --- are different from dimension_slice which is used for tracking partitioning --- column ranges which have different characteristics. --- --- Currently this catalog supports datatypes like INT, SERIAL, BIGSERIAL, --- DATE, TIMESTAMP etc. by storing the ranges in bigint columns. In the --- future, we could support additional datatypes (which support btree style --- >, <, = comparators) by storing their textual representation. --- -CREATE TABLE _timescaledb_catalog.chunk_column_stats ( - id serial NOT NULL, - hypertable_id integer NOT NULL, - chunk_id integer NOT NULL, - column_name name NOT NULL, - range_start bigint NOT NULL, - range_end bigint NOT NULL, - valid boolean NOT NULL, - -- table constraints - CONSTRAINT chunk_column_stats_pkey PRIMARY KEY (id), - CONSTRAINT chunk_column_stats_ht_id_chunk_id_colname_key UNIQUE (hypertable_id, chunk_id, column_name), - CONSTRAINT chunk_column_stats_range_check CHECK (range_start <= range_end), - CONSTRAINT chunk_column_stats_hypertable_id_fkey FOREIGN KEY (hypertable_id) REFERENCES _timescaledb_catalog.hypertable (id), - CONSTRAINT chunk_column_stats_chunk_id_fkey FOREIGN KEY (chunk_id) REFERENCES _timescaledb_catalog.chunk (id) -); - -SELECT pg_catalog.pg_extension_config_dump('_timescaledb_catalog.chunk_column_stats', ''); - -SELECT pg_catalog.pg_extension_config_dump(pg_get_serial_sequence('_timescaledb_catalog.chunk_column_stats', 'id'), ''); - -GRANT SELECT ON _timescaledb_catalog.chunk_column_stats TO PUBLIC; -GRANT SELECT ON _timescaledb_catalog.chunk_column_stats_id_seq TO PUBLIC; diff --git a/sql/updates/reverse-dev.sql b/sql/updates/reverse-dev.sql index 4096ae8198e..e69de29bb2d 100644 --- a/sql/updates/reverse-dev.sql +++ b/sql/updates/reverse-dev.sql @@ -1,7 +0,0 @@ -DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER); --- remove chunk column statistics related objects -DROP FUNCTION IF EXISTS @extschema@.enable_column_stats(REGCLASS, NAME, BOOLEAN); -DROP FUNCTION IF EXISTS @extschema@.disable_column_stats(REGCLASS, NAME, BOOLEAN); -ALTER EXTENSION timescaledb DROP TABLE _timescaledb_catalog.chunk_column_stats; -ALTER EXTENSION timescaledb DROP SEQUENCE _timescaledb_catalog.chunk_column_stats_id_seq; -DROP TABLE IF EXISTS _timescaledb_catalog.chunk_column_stats; diff --git a/version.config b/version.config index 7a440c635c5..7a3a25229c8 100644 --- a/version.config +++ b/version.config @@ -1,3 +1,3 @@ -version = 2.16.0-dev +version = 2.16.0 update_from_version = 2.15.3 downgrade_to_version = 2.15.3