mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Add compression to update tests
Add a test using cmpressed tables to our extension update test suite.
This commit is contained in:
parent
713ceb2a23
commit
707bb9d584
@ -15,7 +15,7 @@ if [ $EXIT_CODE -ne 0 ]; then
|
||||
fi
|
||||
|
||||
|
||||
TAGS="1.3.0-pg10 1.3.1-pg10 1.3.2-pg10 1.4.0-pg10 1.4.1-pg10 1.4.2-pg10 1.5.0-pg10"
|
||||
TAGS="1.3.0-pg10 1.3.1-pg10 1.3.2-pg10 1.4.0-pg10 1.4.1-pg10 1.4.2-pg10"
|
||||
TEST_VERSION="v3"
|
||||
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
@ -23,3 +23,12 @@ EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
TAGS="1.5.0-pg10"
|
||||
TEST_VERSION="v5-pg10"
|
||||
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
@ -23,3 +23,12 @@ EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
TAGS="1.5.0-pg11"
|
||||
TEST_VERSION="v5-pg11"
|
||||
|
||||
TAGS=$TAGS TEST_VERSION=$TEST_VERSION bash ${SCRIPT_DIR}/test_updates.sh
|
||||
EXIT_CODE=$?
|
||||
if [ $EXIT_CODE -ne 0 ]; then
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
16
test/sql/updates/post.compression.sql
Normal file
16
test/sql/updates/post.compression.sql
Normal file
@ -0,0 +1,16 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
SELECT * FROM compress ORDER BY time DESC, small_cardinality;
|
||||
|
||||
INSERT INTO compress
|
||||
SELECT g, 'QW', g::text, 2, 0, (100,4)::custom_type_for_compression, false
|
||||
FROM generate_series('2019-11-01 00:00'::timestamp, '2019-12-15 00:00'::timestamp, '1 day') g;
|
||||
|
||||
SELECT count(compress_chunk(chunk.schema_name|| '.' || chunk.table_name)) as count_compressed
|
||||
FROM _timescaledb_catalog.chunk chunk
|
||||
INNER JOIN _timescaledb_catalog.hypertable hypertable ON (chunk.hypertable_id = hypertable.id)
|
||||
WHERE hypertable.table_name = 'compress' and chunk.compressed_chunk_id IS NULL;
|
||||
|
||||
SELECT * FROM compress ORDER BY time DESC, small_cardinality;
|
8
test/sql/updates/post.v5-pg10.sql
Normal file
8
test/sql/updates/post.v5-pg10.sql
Normal file
@ -0,0 +1,8 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
--skip v4 in PG10
|
||||
\ir post.v3.sql
|
||||
|
||||
\ir post.compression.sql
|
7
test/sql/updates/post.v5-pg11.sql
Normal file
7
test/sql/updates/post.v5-pg11.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
\ir post.v4.sql
|
||||
|
||||
\ir post.compression.sql
|
37
test/sql/updates/setup.compression.sql
Normal file
37
test/sql/updates/setup.compression.sql
Normal file
@ -0,0 +1,37 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
CREATE TYPE custom_type_for_compression AS (high int, low int);
|
||||
|
||||
CREATE TABLE compress (
|
||||
time TIMESTAMPTZ NOT NULL,
|
||||
small_cardinality TEXT NULL,
|
||||
large_cardinality TEXT NULL,
|
||||
some_double DOUBLE PRECISION NULL,
|
||||
some_int integer NULL,
|
||||
some_custom custom_type_for_compression NULL,
|
||||
some_bool boolean NULL
|
||||
);
|
||||
|
||||
SELECT table_name FROM create_hypertable( 'compress', 'time');
|
||||
|
||||
INSERT INTO compress
|
||||
SELECT g, 'POR', g::text, 75.0, 40, (1,2)::custom_type_for_compression, true
|
||||
FROM generate_series('2018-12-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day') g;
|
||||
|
||||
INSERT INTO compress
|
||||
SELECT g, 'POR', NULL, NULL, NULL, NULL, NULL
|
||||
FROM generate_series('2018-11-01 00:00'::timestamp, '2018-12-31 00:00'::timestamp, '1 day') g;
|
||||
|
||||
INSERT INTO compress
|
||||
SELECT g, 'POR', g::text, 94.0, 45, (3,4)::custom_type_for_compression, true
|
||||
FROM generate_series('2018-11-01 00:00'::timestamp, '2018-12-15 00:00'::timestamp, '1 day') g;
|
||||
|
||||
ALTER TABLE compress SET (timescaledb.compress, timescaledb.compress_segmentby='small_cardinality');
|
||||
|
||||
SELECT compress_chunk(chunk.schema_name|| '.' || chunk.table_name) as count_compressed
|
||||
FROM _timescaledb_catalog.chunk chunk
|
||||
INNER JOIN _timescaledb_catalog.hypertable hypertable ON (chunk.hypertable_id = hypertable.id)
|
||||
WHERE hypertable.table_name = 'compress' and chunk.compressed_chunk_id IS NULL
|
||||
ORDER BY chunk.id;
|
7
test/sql/updates/setup.v5-pg10.sql
Normal file
7
test/sql/updates/setup.v5-pg10.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
\ir setup.v4.sql
|
||||
|
||||
\ir setup.compression.sql
|
7
test/sql/updates/setup.v5-pg11.sql
Normal file
7
test/sql/updates/setup.v5-pg11.sql
Normal file
@ -0,0 +1,7 @@
|
||||
-- This file and its contents are licensed under the Apache License 2.0.
|
||||
-- Please see the included NOTICE for copyright information and
|
||||
-- LICENSE-APACHE for a copy of the license.
|
||||
|
||||
\ir setup.v4.sql
|
||||
|
||||
\ir setup.compression.sql
|
Loading…
x
Reference in New Issue
Block a user