-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
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** * timescale#6880: Add support for the array operators used for compressed DML batch filtering. * timescale#6895: Improve the compressed DML expression pushdown. * timescale#6897: Add support for replica identity on compressed hypertables. * timescale#6918: Remove support for PG13. * timescale#6920: Rework compression activity wal markers. * timescale#6989: Add support for foreign keys when converting plain tables to hypertables. * timescale#7020: Add support for the chunk column statistics tracking. * timescale#7048: Add an index scan for INSERT DML decompression. * timescale#7075: Reduce decompression on the compressed INSERT. * timescale#7101: Reduce decompressions for the compressed UPDATE/DELETE. * timescale#7108 Reduce decompressions for INSERTs with UNIQUE constraints * timescale#7116 Use DELETE instead of TRUNCATE after compression * timescale#7134 Refactor foreign key handling for compressed hypertables * timescale#7161 Fix `mergejoin input data is out of order` **Bugfixes** * timescale#6987 Fix REASSIGN OWNED BY for background jobs * timescale#7018: Fix `search_path` quoting in the compression defaults function. * timescale#7046: Prevent locking for compressed tuples. * timescale#7055: Fix the `scankey` for `segment by` columns, where the type `constant` is different to `variable`. * timescale#7064: Fix the bug in the default `order by` calculation in compression. * timescale#7069: Fix the index column name usage. * timescale#7074: Fix the bug in the default `segment by` calculation in compression. **Thanks** * @jledentu For reporting a problem with mergejoin input order
- Loading branch information
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
-- 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 @[email protected]_chunk_skipping( | ||
hypertable REGCLASS, | ||
column_name NAME, | ||
if_not_exists BOOLEAN = FALSE | ||
) RETURNS TABLE(column_stats_id INT, enabled BOOL) | ||
AS 'SELECT NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp; | ||
|
||
-- 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 @[email protected]_chunk_skipping( | ||
hypertable REGCLASS, | ||
column_name NAME, | ||
if_not_exists BOOLEAN = FALSE | ||
) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL) | ||
AS 'SELECT NULL,NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp; | ||
|
||
-- 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; | ||
|
||
-- Remove foreign key constraints from compressed chunks | ||
DO $$ | ||
DECLARE | ||
conrelid regclass; | ||
conname name; | ||
BEGIN | ||
FOR conrelid, conname IN | ||
SELECT | ||
con.conrelid::regclass, | ||
con.conname | ||
FROM _timescaledb_catalog.chunk ch | ||
JOIN pg_constraint con ON con.conrelid = format('%I.%I',schema_name,table_name)::regclass AND con.contype='f' | ||
WHERE NOT ch.dropped AND EXISTS(SELECT FROM _timescaledb_catalog.chunk ch2 WHERE NOT ch2.dropped AND ch2.compressed_chunk_id=ch.id) | ||
LOOP | ||
EXECUTE format('ALTER TABLE %s DROP CONSTRAINT %I', conrelid, conname); | ||
END LOOP; | ||
END $$; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER); | ||
-- remove chunk column statistics related objects | ||
DROP FUNCTION IF EXISTS @[email protected]_chunk_skipping(REGCLASS, NAME, BOOLEAN); | ||
DROP FUNCTION IF EXISTS @[email protected]_chunk_skipping(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; | ||
|
||
-- Add foreign key constraints back to compressed chunks | ||
DO $$ | ||
DECLARE | ||
chunkrelid regclass; | ||
conname name; | ||
conoid oid; | ||
BEGIN | ||
FOR chunkrelid, conname, conoid IN | ||
SELECT format('%I.%I',ch.schema_name,ch.table_name)::regclass, con.conname, con.oid | ||
FROM _timescaledb_catalog.hypertable ht | ||
JOIN pg_constraint con ON con.contype = 'f' AND con.conrelid=format('%I.%I',ht.schema_name,ht.table_name)::regclass | ||
JOIN _timescaledb_catalog.chunk ch on ch.hypertable_id=ht.compressed_hypertable_id and not ch.dropped | ||
LOOP | ||
EXECUTE format('ALTER TABLE %s ADD CONSTRAINT %I %s', chunkrelid, conname, pg_get_constraintdef(conoid)); | ||
END LOOP; | ||
END $$; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +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 @[email protected]_chunk_skipping( | ||
hypertable REGCLASS, | ||
column_name NAME, | ||
if_not_exists BOOLEAN = FALSE | ||
) RETURNS TABLE(column_stats_id INT, enabled BOOL) | ||
AS 'SELECT NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp; | ||
|
||
-- 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 @[email protected]_chunk_skipping( | ||
hypertable REGCLASS, | ||
column_name NAME, | ||
if_not_exists BOOLEAN = FALSE | ||
) RETURNS TABLE(hypertable_id INT, column_name NAME, disabled BOOL) | ||
AS 'SELECT NULL,NULL,NULL' LANGUAGE SQL VOLATILE SET search_path = pg_catalog, pg_temp; | ||
|
||
-- 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; | ||
|
||
-- Remove foreign key constraints from compressed chunks | ||
DO $$ | ||
DECLARE | ||
conrelid regclass; | ||
conname name; | ||
BEGIN | ||
FOR conrelid, conname IN | ||
SELECT | ||
con.conrelid::regclass, | ||
con.conname | ||
FROM _timescaledb_catalog.chunk ch | ||
JOIN pg_constraint con ON con.conrelid = format('%I.%I',schema_name,table_name)::regclass AND con.contype='f' | ||
WHERE NOT ch.dropped AND EXISTS(SELECT FROM _timescaledb_catalog.chunk ch2 WHERE NOT ch2.dropped AND ch2.compressed_chunk_id=ch.id) | ||
LOOP | ||
EXECUTE format('ALTER TABLE %s DROP CONSTRAINT %I', conrelid, conname); | ||
END LOOP; | ||
END $$; | ||
|
||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +0,0 @@ | ||
DROP FUNCTION IF EXISTS _timescaledb_functions.cagg_get_bucket_function_info(INTEGER); | ||
-- remove chunk column statistics related objects | ||
DROP FUNCTION IF EXISTS @[email protected]_chunk_skipping(REGCLASS, NAME, BOOLEAN); | ||
DROP FUNCTION IF EXISTS @[email protected]_chunk_skipping(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; | ||
|
||
-- Add foreign key constraints back to compressed chunks | ||
DO $$ | ||
DECLARE | ||
chunkrelid regclass; | ||
conname name; | ||
conoid oid; | ||
BEGIN | ||
FOR chunkrelid, conname, conoid IN | ||
SELECT format('%I.%I',ch.schema_name,ch.table_name)::regclass, con.conname, con.oid | ||
FROM _timescaledb_catalog.hypertable ht | ||
JOIN pg_constraint con ON con.contype = 'f' AND con.conrelid=format('%I.%I',ht.schema_name,ht.table_name)::regclass | ||
JOIN _timescaledb_catalog.chunk ch on ch.hypertable_id=ht.compressed_hypertable_id and not ch.dropped | ||
LOOP | ||
EXECUTE format('ALTER TABLE %s ADD CONSTRAINT %I %s', chunkrelid, conname, pg_get_constraintdef(conoid)); | ||
END LOOP; | ||
END $$; | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |