2020-06-20 11:29:01 +00:00
|
|
|
SET send_logs_level = 'fatal';
|
2019-09-02 12:53:31 +00:00
|
|
|
SET joined_subquery_requires_alias = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_synthetic;
|
|
|
|
DROP TABLE IF EXISTS default_codec_synthetic;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE delta_codec_synthetic
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
2020-03-24 16:53:12 +00:00
|
|
|
id UInt64 Codec(Delta, ZSTD(3))
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE default_codec_synthetic
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
2020-03-24 16:53:12 +00:00
|
|
|
id UInt64 Codec(ZSTD(3))
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
INSERT INTO delta_codec_synthetic SELECT number FROM system.numbers LIMIT 5000000;
|
|
|
|
INSERT INTO default_codec_synthetic SELECT number FROM system.numbers LIMIT 5000000;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
OPTIMIZE TABLE delta_codec_synthetic FINAL;
|
|
|
|
OPTIMIZE TABLE default_codec_synthetic FINAL;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
floor(big_size / small_size) AS ratio
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) AS small_size FROM system.parts WHERE database == currentDatabase() and table == 'delta_codec_synthetic')
|
2019-01-15 16:34:43 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) as big_size FROM system.parts WHERE database == currentDatabase() and table == 'default_codec_synthetic')
|
2019-01-15 16:34:43 +00:00
|
|
|
USING(key);
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
small_hash == big_hash
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS small_hash FROM delta_codec_synthetic)
|
2019-01-15 16:34:43 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS big_hash FROM default_codec_synthetic)
|
2019-01-15 16:34:43 +00:00
|
|
|
USING(key);
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_synthetic;
|
|
|
|
DROP TABLE IF EXISTS default_codec_synthetic;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_float;
|
|
|
|
DROP TABLE IF EXISTS default_codec_float;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE delta_codec_float
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
|
|
|
id Float64 Codec(Delta, LZ4HC)
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE default_codec_float
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
|
|
|
id Float64 Codec(LZ4HC)
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
INSERT INTO delta_codec_float SELECT number FROM numbers(1547510400, 500000) WHERE number % 3 == 0 OR number % 5 == 0 OR number % 7 == 0 OR number % 11 == 0;
|
|
|
|
INSERT INTO default_codec_float SELECT * from delta_codec_float;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
OPTIMIZE TABLE delta_codec_float FINAL;
|
|
|
|
OPTIMIZE TABLE default_codec_float FINAL;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
floor(big_size / small_size) as ratio
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) AS small_size FROM system.parts WHERE database = currentDatabase() and table = 'delta_codec_float')
|
2019-01-15 16:19:20 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) as big_size FROM system.parts WHERE database = currentDatabase() and table = 'default_codec_float') USING(key);
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-01-15 16:34:43 +00:00
|
|
|
SELECT
|
|
|
|
small_hash == big_hash
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS small_hash FROM delta_codec_float)
|
2019-01-15 16:34:43 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS big_hash FROM default_codec_float)
|
2019-01-15 16:34:43 +00:00
|
|
|
USING(key);
|
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_float;
|
|
|
|
DROP TABLE IF EXISTS default_codec_float;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_string;
|
|
|
|
DROP TABLE IF EXISTS default_codec_string;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE delta_codec_string
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
|
|
|
id Float64 Codec(Delta, LZ4)
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
CREATE TABLE default_codec_string
|
2019-01-15 16:19:20 +00:00
|
|
|
(
|
|
|
|
id Float64 Codec(LZ4)
|
2020-06-27 21:18:27 +00:00
|
|
|
) ENGINE MergeTree() ORDER BY tuple() SETTINGS min_bytes_for_wide_part = 0;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
INSERT INTO delta_codec_string SELECT concat(toString(number), toString(number % 100)) FROM numbers(1547510400, 500000);
|
|
|
|
INSERT INTO default_codec_string SELECT * from delta_codec_string;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
OPTIMIZE TABLE delta_codec_string FINAL;
|
|
|
|
OPTIMIZE TABLE default_codec_string FINAL;
|
2019-01-15 16:19:20 +00:00
|
|
|
|
|
|
|
SELECT
|
|
|
|
floor(big_size / small_size) as ratio
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) AS small_size FROM system.parts WHERE database = currentDatabase() and table = 'delta_codec_string')
|
2019-01-15 16:19:20 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(bytes_on_disk) as big_size FROM system.parts WHERE database = currentDatabase() and table = 'default_codec_string') USING(key);
|
2019-01-15 16:19:20 +00:00
|
|
|
|
2019-01-15 16:34:43 +00:00
|
|
|
SELECT
|
|
|
|
small_hash == big_hash
|
|
|
|
FROM
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS small_hash FROM delta_codec_string)
|
2019-01-15 16:34:43 +00:00
|
|
|
INNER JOIN
|
2019-06-07 16:02:24 +00:00
|
|
|
(SELECT 1 AS key, sum(cityHash64(*)) AS big_hash FROM default_codec_string)
|
2019-01-15 16:34:43 +00:00
|
|
|
USING(key);
|
|
|
|
|
2019-06-07 16:02:24 +00:00
|
|
|
DROP TABLE IF EXISTS delta_codec_string;
|
|
|
|
DROP TABLE IF EXISTS default_codec_string;
|