timescaledb/tsl/test/expected/compression_algos.out
Alexander Kuzmenkov e92d5ba748 Add more tests for compression
Unit tests for different data sequences, and SQL test for float4.
2023-03-10 20:34:17 +04:00

1541 lines
118 KiB
Plaintext

-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
--install necessary functions for tests
\c :TEST_DBNAME :ROLE_SUPERUSER
CREATE OR REPLACE FUNCTION ts_test_compression() RETURNS VOID
AS :TSL_MODULE_PATHNAME LANGUAGE C VOLATILE;
\ir include/compression_utils.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
\c :TEST_DBNAME :ROLE_DEFAULT_PERM_USER
-- helper function: float -> pseudorandom float [0..1].
create or replace function mix(x float4) returns float4 as $$ select ((hashfloat4(x) / (pow(2., 31) - 1) + 1) / 2)::float4 $$ language sql;
create or replace function mix(x timestamptz) returns float4 as $$ select mix(extract(epoch from x)::float4) $$ language sql;
------------------
-- C unit tests --
------------------
SELECT ts_test_compression();
ts_test_compression
---------------------
(1 row)
------------------------
-- BIGINT Compression --
------------------------
SELECT
$$
select item from base_ints order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_ints
\set TYPE BIGINT
\set COMPRESSION_CMD _timescaledb_internal.compress_deltadelta(item)
\set DECOMPRESS_FORWARD_CMD _timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::BIGINT)
\set DECOMPRESS_REVERSE_CMD _timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::BIGINT)
-- random order
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::bigint FROM (select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
psql:include/compression_test.sql:7: NOTICE: table "compressed" does not exist, skipping
compressed size
-----------------
1720
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
-- ascending order with nulls
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::bigint FROM (SELECT generate_series(1, 1000) item) sub;
INSERT INTO base_ints VALUES (0, NULL), (10, NULL), (10000, NULL);
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
93
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
SELECT c ints_text FROM compressed;
ints_text
--------------------------------------------------------------------------------------------------------------------------
BAEAAAAAAAAD6AAAAAAAAAABAAAD6AAAAAIAAAAAAAAA8gAAAAAAAAACAAA8gAAAAAAAAAPrAAAAAwAAAAAAAAHxAAAAAAAABAEAADqgAAAAAAAAAAAAAAAB
(1 row)
DROP TABLE base_ints;
-- single element
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::bigint FROM (SELECT generate_series(1, 1) item) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
45
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
-- really big deltas
SELECT 9223372036854775807 as big_int_max \gset
SELECT -9223372036854775808 as big_int_min \gset
CREATE TABLE base_ints AS SELECT row_number() over () as rn, item FROM
(
VALUES
--big deltas
(0), (:big_int_max), (:big_int_min), (:big_int_max), (:big_int_min),
(0), (:big_int_min), (32), (5), (:big_int_min), (-52), (:big_int_max),
(1000),
--big delta_deltas
(0), (:big_int_max), (:big_int_max), (:big_int_min), (:big_int_min), (:big_int_max), (:big_int_max),
(0), (:big_int_max-1), (:big_int_max-1), (:big_int_min), (:big_int_min), (:big_int_max-1), (:big_int_max-1)
) as t(item);
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
184
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
-- NULLs
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, NULLIF(i, 5) item FROM generate_series(1::BIGINT, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
69
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, NULLIF(i, 1) item FROM generate_series(1::BIGINT, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
69
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, NULLIF(i, 10) item FROM generate_series(1::BIGINT, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
69
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, NULLIF(NULLIF(NULLIF(NULLIF(i, 2), 4), 5), 8) item FROM generate_series(1::BIGINT, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
69
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
------------------------
-- INT Compression --
------------------------
CREATE TABLE base_ints AS SELECT row_number() OVER() as rn, item::int FROM (select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
SELECT
$$
select item::bigint from base_ints order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_ints
\set TYPE BIGINT
\set COMPRESSION_CMD _timescaledb_internal.compress_deltadelta(item::bigint)
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
1720
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_ints;
-----------------------------
-- TIMESTAMPTZ Compression --
-----------------------------
SELECT
$$
select item from base_time order by rn
$$ AS "QUERY"
\gset
\set TYPE TIMESTAMPTZ
\set TABLE_NAME base_time
\set COMPRESSION_CMD _timescaledb_internal.compress_deltadelta(item)
\set DECOMPRESS_FORWARD_CMD _timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::TIMESTAMPTZ)
\set DECOMPRESS_REVERSE_CMD _timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::TIMESTAMPTZ)
CREATE TABLE base_time AS SELECT row_number() OVER() as rn, item FROM
(select sub.item from (SELECT generate_series('2018-03-02 1:00'::TIMESTAMPTZ, '2018-03-28 1:00', '1 hour') item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
5332
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_time;
------------------------
-- FLOAT4 Compression --
------------------------
SELECT
$$
select item from base_floats order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_floats
SELECT 'real' as "TYPE" \gset
\set COMPRESSION_CMD _timescaledb_internal.compress_gorilla(item)
SELECT '_timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::float4)' AS "DECOMPRESS_FORWARD_CMD" \gset
SELECT '_timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::float4)' AS "DECOMPRESS_REVERSE_CMD" \gset
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, item::float4 FROM
(select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
1808
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
SELECT c gorilla_text FROM compressed;
gorilla_text
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AwAAAAAARA4AAAAAA+gAAAABAAAAAAAAAA8AAD6AAAAAAQAAA+gAAAAEAAAAAAAA8f8AAAQQAAAAAQAAICAAAAAAAAAAAAAAABkAABZQAAAAAAAAAAcYmmmWmeeiiWGmmmoluqllqpZZZZ5ZZqJ5WWWiWqWWWWXolloommonlqZaqpaKZpZaAAAAAACWmGUAAABEAAAABQAAAAAABURFAxSJYdCDHbGsull4inw43czdfX3dyt272WrMaauIm5QAAABqYNO05wAAAMg0rP88cPkLETXMrl79rvV+T+nBw5Dq8529/YT+ds7SN4z39+3w3357HtfFmv0r5F63z+8G+L+Uvw0j5v4vf7xOA8en963B39PrEa8f3f0Nur+EhcwmZ4tDgP+6OcVQeW5c13pIAIF3+G8l5O86OgAeQc/5H5OEs599H2RhFQ4X5bxQbj+0CUB57Z1IHUO088diHpz34Oa6WhD63dRwvoIT5PV0Rd5PBCAbpnVzq0AaQG7eoCiGeDy0jBdFHt/vgcSdYIOV/XD1BKCOJPvCu5PVyGn0+ByAdA4kecrvogUjwsG0E8BDACelBYcWwA4FHrryMK19c98dIgzcuw3AfYPkBYDAOoCvA9Byh5BSRk4/MKr6v41++BmeRLWTRgFDjT7zC/5BCyB2vacqg0e10hJ72J0ek5J+U/UAQQkf4sEF9c0R7G+1AbwvQbwMV4ex0DOCIAGDXcjOMQEk8VsbqEPs+J8LEGDkA6gFP7QQ/0n8lAh7NIPHEO+H8e23SL4R7PBX4C+Qe5QPgfGfw44Nx988ZdI+geQA2XujbIJox1gwwAHk9j7B9XQQvxI3QLp4LC/++7WBSM3mUHmv5UILywFXDGBog0vsvkP3f5X/EGCAtBPJKFQOXoA8OhQAdBzyBA8p5r4u8EYaHTEBne+RS8MdHqq9qwSns32AhAPuAa9z+cerekKeSvAJF8/yuDQ8L9VR3B3vCWMA2d/mhkwAxZAoPEHNNtQDcKMHwxJnsDg8cQif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AQB/ww/vPjwOoId9HYUX+Grdp/ceGQQYTr6N5WBcFgGKGCCZUwP0XZbkP8BD36HLNHFBgg8gsHWLuuElBhuI1jcUhMHswKeyvRN127UCRBAhyg1gIP/FWBWZ5zDeRkGaBrBFgBBmSHJnhq3295mCgfYeJYTiaBdAVxiWD5AkDCgiAGexA4YWfwgeazxER/Oh/vzgMQg4rYL4SkKicG0qEUP3AMn6RkgOBtM8HeYDUf9vLPz8eOpkmwBU9XBw5g+PQsQkbhA+LqXqnNoA9ChXI7d4aH2vwX+8HPAZgBLqabwaPgb4kAD08aWwCe6A==
(1 row)
DROP TABLE base_floats;
-- single element
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, item::float4 FROM (SELECT generate_series(1, 1) item) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
109
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
--special values
CREATE TABLE base_floats AS SELECT row_number() over () as rn, item FROM
(
VALUES
--special
(0::float4), ('Infinity'), ('-Infinity'), ('NaN'),
--big deltas
(0), ('Infinity'), ('-Infinity'), ('Infinity'), ('-Infinity'),
(0), ('-Infinity'), (32), (5), ('-Infinity'), (-52), ('Infinity'),
(1000),
--big delta_deltas
(0), ('Infinity'), ('Infinity'), ('-Infinity'), ('-Infinity'), ('Infinity'), ('Infinity')
) as t(item);
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
152
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
-- all 0s
CREATE TABLE base_floats AS SELECT row_number() over () as rn, 0::float4 as item FROM (SELECT generate_series(1, 1000) ) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
160
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
-- NULLs
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, NULLIF(i, 5)::float4 item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, NULLIF(i, 1)::float4 item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, NULLIF(i, 10)::float4 item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
CREATE TABLE base_floats AS SELECT row_number() OVER() as rn, NULLIF(NULLIF(NULLIF(NULLIF(i, 2), 4), 5), 8)::float4 item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_floats;
------------------------
-- DOUBLE Compression --
------------------------
SELECT
$$
select item from base_doubles order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_doubles
SELECT 'DOUBLE PRECISION' as "TYPE" \gset
\set COMPRESSION_CMD _timescaledb_internal.compress_gorilla(item)
SELECT '_timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::DOUBLE PRECISION)' AS "DECOMPRESS_FORWARD_CMD" \gset
SELECT '_timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::DOUBLE PRECISION)' AS "DECOMPRESS_REVERSE_CMD" \gset
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, item::double precision FROM
(select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
1808
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
SELECT c gorilla_text FROM compressed;
gorilla_text
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AwBAgcAAAAAAAAAAA+gAAAABAAAAAAAAAA8AAD6AAAAAAQAAA+gAAAAEAAAAAAAA8f8AAAQQAAAAAQAAICAAAAAAAAAAAAAAABkAABZQAAAAAAAAAAcYwwwgwoossgFJJJLIRNIINCCCCCiCCSyigggsg0ggggiLIILLJJLKIDCDTSCzCSCDAAAAAAAgwEgAAABEAAAABQAAAAAABURFAxSJYdCDHbSsull4inw43czdfX3dyt272WrMaauIm5QAAABqZtO05wAAAMhAZ/njh8hYETVlcvftd6vyfU4OHIdXnO3u7CfztnaRvGe/v2+G+/PY974s1+lfIvW/f3g3xfyl+G4fN/F7/eJwHj0/vW4O/p9ZjXj+7+ht1f4kLmEzPFocAP3RziqDy3Lku9JABAu/w38vJ3nR0ADyDn/I/JwlnPvp+yMIqHC/LeaDcf2gSgPPaOpA6h2nnjsS9Oe/BzXS0ITW7qOF9BCfIKuiLv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MpA8DqhC/TQRL2MGyAhss7mc6AkbNPUnmfCKI4KeDl41di/+PP+/PAX3uKC6d4B6q9bfJ/4jeHUoG75xBkC57rgbO9W/P3Ieb9MFYB0BUBhf6PGIIFjnfIKNm4xlv4LfeqwQNiTITqBJcAU+p9Q/ICkOZ3sj3YXXjoSEMiZYE+fSrRyQ7SgfzoZuEDIFlDoAKeCHHDvnkkHb+gFecg/pAkPKRDQpQI4g8a84oeQ9z8i+8geL+wU4M4Cm7EiC5VeDiQGrsIoEQCN9/+YcbAM+6gdxJrZvhj670bGee17zAVwIYT8Pf2bjaBZiSN4M2fYAAXnIOELYJsHd+f/nvwEpMQYIoNaGrpcGbCEgkOBf0vtXkgAYKGwj5NBNAyvfkwAmAQDRzcT2VgizIBz/4AwQNQe3pEK/p566HTD8Petlu63ez+4JkCz4Q+Gb2jGEivUfhL4V/lEJzdD7gvASI9vDIJb+D+LHjzY7N9l+nYKwGQLECSEgCUBGDxgsfTvpATkoOYuFABr0VAQB/wwIaPjwOoId9H6EX+Grdp/cf7wQYTr6N5W2FFgGKGCCZXhn0XZbkP8BAXKHLNHFBggMDsHWLuuElA9+I1jcUhMHvIKeyvRN127YbRBAhyg1gLMDFWBWZ5zDVAkGaBrBFgBD/SHJnhq32/kaCgfYeJYTgZhdAVxiWD5eZDCgiAGexAmgWfwgeazxAJPOh/vzgMQOGrYL4SkKidEcqEUP3AMn4OEgOBtM8HeBtUf9vLPz8ekZkmwBU9XB2Aw+PQsQkbhjqLqXqnNoA8OZXI7d4aH2gPn+8HPAZgBQoabwaPgb4n8H08aWwCe6C6g==
(1 row)
DROP TABLE base_doubles;
-- single element
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, item::double precision FROM (SELECT generate_series(1, 1) item) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
109
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
--special values
CREATE TABLE base_doubles AS SELECT row_number() over () as rn, item FROM
(
VALUES
--special
(0::double precision), ('Infinity'), ('-Infinity'), ('NaN'),
--big deltas
(0), ('Infinity'), ('-Infinity'), ('Infinity'), ('-Infinity'),
(0), ('-Infinity'), (32), (5), ('-Infinity'), (-52), ('Infinity'),
(1000),
--big delta_deltas
(0), ('Infinity'), ('Infinity'), ('-Infinity'), ('-Infinity'), ('Infinity'), ('Infinity')
) as t(item);
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
152
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
-- all 0s
CREATE TABLE base_doubles AS SELECT row_number() over () as rn, 0::FLOAT(50) as item FROM (SELECT generate_series(1, 1000) ) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
160
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
-- NULLs
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, NULLIF(i, 5)::DOUBLE PRECISION item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, NULLIF(i, 1)::DOUBLE PRECISION item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, NULLIF(i, 10)::DOUBLE PRECISION item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
CREATE TABLE base_doubles AS SELECT row_number() OVER() as rn, NULLIF(NULLIF(NULLIF(NULLIF(i, 2), 4), 5), 8)::DOUBLE PRECISION item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
136
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_doubles;
------------------------
-- Dictionary Compression --
------------------------
SELECT
$$
select item from base_texts order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_texts
SELECT 'TEXT' as "TYPE" \gset
\set COMPRESSION_CMD _timescaledb_internal.compress_dictionary(item)
\set DECOMPRESS_FORWARD_CMD _timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::TEXT)
\set DECOMPRESS_REVERSE_CMD _timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::TEXT)
-- high cardinality
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, item::text FROM
(select sub.item from (SELECT generate_series(1, 1000) item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
4305
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
SELECT c from compressed;
c
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AQBwZ19jYXRhbG9nAHRleHQAAAEAAAPoAAAAAzgyMQAAAAMyMzYAAAADNDY4AAAAAzIzMAAAAAI4NAAAAAMzMDAAAAADNDU0AAAAAzY4MgAAAAM4OTUAAAADNzM1AAAAAzkxMQAAAAM4OTEAAAACMzIAAAADOTE3AAAAAzgwOAAAAAM4MDIAAAADMjQxAAAAAzQzOAAAAAIxOQAAAAI3NAAAAAIxOAAAAAMxMDgAAAADMzg2AAAAAzI0OQAAAAIyOQAAAAM5ODAAAAADMzc1AAAAAjg5AAAAAzgyOAAAAAMxNzIAAAADODQxAAAAAzQyNQAAAAM1NzAAAAADMTIwAAAAAzc5OQAAAAMyMjkAAAADNzAzAAAAAzUyOQAAAAMxNDYAAAADMzkyAAAAAzU0MQAAAAMxNzQAAAADNzQyAAAAAjQ1AAAAAzIxMgAAAAM0MDcAAAACMjUAAAADNDc2AAAAAzE1MwAAAAM0OTIAAAADNzE2AAAAAzEzMwAAAAMyOTcAAAADMjg0AAAAAzg4NgAAAAEzAAAAAzE1NQAAAAMyMzcAAAADNDA1AAAAAzc0OQAAAAM1ODMAAAADNzUzAAAAAzQyNAAAAAMyNzQAAAADNTM5AAAAAzc2OQAAAAM3MDUAAAADMzc0AAAAAjY4AAAAAzUwMgAAAAMxMjEAAAADNjA3AAAAAzY4NQAAAAMxOTAAAAADOTk2AAAAAzI2OQAAAAM3OTEAAAADNjA4AAAAAzYxMgAAAAMzNzkAAAADMjE0AAAAAzE3NQAAAAM5NTYAAAADMjEzAAAAAzk2OQAAAAMxODcAAAADNTM1AAAAAzgyNwAAAAMyNzAAAAADOTA5AAAAAzUwMQAAAAM2MzYAAAADOTU4AAAAAzY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AAM1MTYAAAADNjYxAAAAAzgzMQAAAAM0MjIAAAACMTQAAAADNzM2AAAAAzM5NgAAAAMzODgAAAADMjAxAAAAAzE2MgAAAAM0NzgAAAADMTIzAAAAAzY3OQAAAAI2NgAAAAIyMwAAAAMzMjkAAAADMjMyAAAAAzE2NgAAAAM3MjMAAAADNDczAAAAAzM3NwAAAAM2NjAAAAADODcwAAAAAjYzAAAAAzEwNQAAAAMzMzIAAAACNzMAAAADODU2AAAAAzg3NQAAAAM5OTUAAAADNjE0AAAAAzU3OAAAAAI1OAAAAAMyODUAAAADNTU0AAAAAzg0NQAAAAM2NTQAAAADNTg2AAAAAzQ5MQAAAAMyNzYAAAADOTQ5AAAAAzE2OQAAAAI2MgAAAAMyMDkAAAADMTQyAAAAAzMyNwAAAAM5MDUAAAADODMyAAAAAzM4MAAAAAI4NQAAAAM3NjQAAAADMzgxAAAAAzc1NgAAAAMxMTkAAAACNzkAAAADMTQwAAAAAzQ5NwAAAAM3MzMAAAADMzIyAAAAAzg4MgAAAAM3MzAAAAADNzcwAAAAAzQ3MAAAAAM1MDgAAAADMTAwAAAAAzk1MwAAAAMyMjYAAAADNDg3AAAAAzM0MgAAAAM2NTcAAAADMTQ4AAAAAzE2OAAAAAI3OAAAAAM3MjcAAAADMjMxAAAAAzMxOQAAAAM2ODYAAAADNzgzAAAAAjMxAAAAAzcwNwAAAAM4OTcAAAADOTAwAAAAAzk1MQAAAAM2MzIAAAADNDY3AAAAAzY3NQAAAAM0NzIAAAADOTUwAAAAAzg3MQAAAAI5NwAAAAMzNjYAAAADNTY0AAAAAjM1AAAAAzMzOQAAAAM1Njg=
(1 row)
DROP TABLE base_texts;
-- low cardinality
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, item::text FROM
(SELECT i as item FROM generate_series(1, 10) i, generate_series(1, 100) j ORDER BY mix(i + j)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
605
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-- single element
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, item::text FROM (SELECT generate_series(1, 1) item) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
39
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-- high cardinality with toasted values
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, repeat(item::text, 100000) as item FROM
(select sub.item from (SELECT generate_series(1, 10) item) as sub ORDER BY mix(item)) sub;
--make sure it's toasted
SELECT pg_total_relation_size(reltoastrelid)
FROM pg_class c
WHERE relname = 'base_texts';
pg_total_relation_size
------------------------
24576
(1 row)
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
1100092
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-- NULLs
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 5)::TEXT item FROM generate_series(1, 10) i, generate_series(1, 100) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
187
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 1)::TEXT item FROM generate_series(1, 10) i, generate_series(1, 100) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
179
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 10)::TEXT item FROM generate_series(1, 10) i, generate_series(1, 100) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
178
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(NULLIF(NULLIF(NULLIF(i, 2), 4), 5), 8)::TEXT item FROM generate_series(1, 10) i, generate_series(1, 100) j;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
189
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-----------------------
-- Array Compression --
-----------------------
SELECT
$$
select item from base_texts order by rn
$$ AS "QUERY"
\gset
\set TABLE_NAME base_texts
SELECT 'TEXT' as "TYPE" \gset
\set COMPRESSION_CMD _timescaledb_internal.compress_array(item)
\set DECOMPRESS_FORWARD_CMD _timescaledb_internal.decompress_forward(c::_timescaledb_internal.compressed_data, NULL::TEXT)
\set DECOMPRESS_REVERSE_CMD _timescaledb_internal.decompress_reverse(c::_timescaledb_internal.compressed_data, NULL::TEXT)
--basic test
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, item::text FROM
(select sub.item from (SELECT generate_series(1, 100) item) as sub ORDER BY mix(item)) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
356
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
SELECT c from compressed;
c
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
AQBwZ19jYXRhbG9nAHRleHQAAAEAAABkAAAAAjg0AAAAAjMyAAAAAjE5AAAAAjc0AAAAAjE4AAAAAjI5AAAAAjg5AAAAAjQ1AAAAAjI1AAAAATMAAAACNjgAAAABNQAAAAIxMgAAAAE4AAAAAjk1AAAAAjg3AAAAAjE2AAAAAjM5AAAAAjY0AAAAAjc3AAAAAjE3AAAAAjI4AAAAAjQwAAAAAjQzAAAAAjQ2AAAAAjU0AAAAAjM4AAAAATkAAAACNTkAAAACNDQAAAACMTEAAAACOTgAAAACNTUAAAACODMAAAACMjAAAAACOTkAAAACODIAAAACMzYAAAACNDgAAAACNzAAAAACMTAAAAACNzUAAAACMzQAAAACMTUAAAABNAAAAAIyNAAAAAI4MAAAAAI1MQAAAAI1MgAAAAIxMwAAAAI0NwAAAAE2AAAAAjIyAAAAAjUwAAAAAjgxAAAAAjQ5AAAAATEAAAACNzYAAAACNjcAAAACNjEAAAACNDIAAAACMzcAAAACNzEAAAACNjkAAAACMzMAAAACOTYAAAACNTMAAAACMjYAAAACOTQAAAACMjcAAAACNjAAAAACNTcAAAACMjEAAAACOTAAAAACNjUAAAACODgAAAABMgAAAAI0MQAAAAIzMAAAAAI5MwAAAAI5MQAAAAI1NgAAAAI4NgAAAAE3AAAAAjkyAAAAAjcyAAAAAjE0AAAAAjY2AAAAAjIzAAAAAjYzAAAAAjczAAAAAjU4AAAAAjYyAAAAAjg1AAAAAjc5AAAAAzEwMAAAAAI3OAAAAAIzMQAAAAI5NwAAAAIzNQ==
(1 row)
DROP TABLE base_texts;
-- single element
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, item::text FROM (SELECT generate_series(1, 1) item) sub;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
39
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-- toasted values
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, repeat(item::text, 100000) as item FROM
(select sub.item from (SELECT generate_series(1, 10) item) as sub ORDER BY mix(item)) sub;
--make sure it's toasted
SELECT pg_total_relation_size(reltoastrelid)
FROM pg_class c
WHERE relname = 'base_texts';
pg_total_relation_size
------------------------
24576
(1 row)
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
1100092
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
-- NULLs
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 5)::TEXT item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
80
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 1)::TEXT item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
80
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(i, 10)::TEXT item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
79
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;
CREATE TABLE base_texts AS SELECT row_number() OVER() as rn, NULLIF(NULLIF(NULLIF(NULLIF(i, 2), 4), 5), 8)::TEXT item FROM generate_series(1, 10) i;
\ir include/compression_test.sql
-- This file and its contents are licensed under the Timescale License.
-- Please see the included NOTICE for copyright information and
-- LICENSE-TIMESCALE for a copy of the license.
\set ECHO errors
compressed size
-----------------
74
(1 row)
?column? | count
-------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed forward (expect 0) | 0
(1 row)
?column? | count
--------------------------------------------------------------------------------+-------
Number of rows different between original and decompressed reversed (expect 0) | 0
(1 row)
?column? | count
----------------------------------------------------------------------------------------------------+-------
Number of rows different between original, decompressed, and decompressed deserializeed (expect 0) | 0
(1 row)
?column? | ?column?
-----------------------------------------------------------------------------------------------------+----------
Test that deserialization, decompression, recompression, and serialization results in the same text | t
(1 row)
DROP TABLE base_texts;