From 269bcdb0a664f18041e1359c69d157c4db7d02b6 Mon Sep 17 00:00:00 2001 From: Matthew McNew Date: Mon, 4 Nov 2024 08:26:21 -0600 Subject: [PATCH] Updated results for TimescaleDB 2.17 - Update TimescaleDB to include Compression as the default TimescaleDB setup. - Move uncompressed to "TimescaleDB (No Columnstore)" --- timescaledb-compressed/benchmark.sh | 48 -------- .../results/c6a.4xlarge.json | 58 --------- timescaledb-no-columnstore/benchmark.sh | 40 ++++++ .../create.sql | 0 .../queries.sql | 0 .../results/c6a.4xlarge.json | 59 +++++++++ .../run.sh | 2 +- timescaledb/benchmark.sh | 39 +++--- timescaledb/results/c6a.4xlarge.json | 114 +++++++++--------- timescaledb/run.sh | 2 +- 10 files changed, 182 insertions(+), 180 deletions(-) delete mode 100755 timescaledb-compressed/benchmark.sh delete mode 100644 timescaledb-compressed/results/c6a.4xlarge.json create mode 100755 timescaledb-no-columnstore/benchmark.sh rename {timescaledb-compressed => timescaledb-no-columnstore}/create.sql (100%) rename {timescaledb-compressed => timescaledb-no-columnstore}/queries.sql (100%) create mode 100644 timescaledb-no-columnstore/results/c6a.4xlarge.json rename {timescaledb-compressed => timescaledb-no-columnstore}/run.sh (68%) mode change 100755 => 100644 timescaledb/benchmark.sh diff --git a/timescaledb-compressed/benchmark.sh b/timescaledb-compressed/benchmark.sh deleted file mode 100755 index 817c8e8be..000000000 --- a/timescaledb-compressed/benchmark.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -# Install -export DEBIAN_FRONTEND=noninteractive -sudo apt-get update -sudo apt-get install -y gnupg postgresql-common apt-transport-https lsb-release wget -sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -sudo bash -c 'echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list' -wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - -sudo apt-get update -sudo apt-get install -y timescaledb-2-postgresql-14 -sudo bash -c "echo \"shared_preload_libraries = 'timescaledb'\" >> /etc/postgresql/14/main/postgresql.conf" -sudo systemctl restart postgresql - -sudo -u postgres psql -c "CREATE DATABASE test" -sudo -u postgres psql test -c "CREATE EXTENSION IF NOT EXISTS timescaledb" - -# Import the data - -wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz' -gzip -d hits.tsv.gz -sudo chmod og+rX ~ -chmod 777 hits.tsv - -sudo -u postgres psql test < create.sql -sudo -u postgres psql test -c "SELECT create_hypertable('hits', 'eventtime')" -sudo -u postgres psql test -c "CREATE INDEX ix_counterid ON hits (counterid)" -sudo -u postgres psql test -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_orderby = 'counterid, eventdate, userid, eventtime')" -sudo -u postgres psql test -c "SELECT add_compression_policy('hits', INTERVAL '1s')" - -sudo -u postgres psql test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'" - -# 1619875.288 ms (26:59.875) - -# See https://github.com/timescale/timescaledb/issues/4473#issuecomment-1167095245 -# https://docs.timescale.com/timescaledb/latest/how-to-guides/compression/manually-compress-chunks/#compress-chunks-manually -# TimescaleDB benchmark wihout compression is available in timescaledb directory - -time sudo -u postgres psql test -c "SELECT compress_chunk(i, if_not_compressed => true) FROM show_chunks('hits') i" - -# 49m45.120s - -./run.sh 2>&1 | tee log.txt - -sudo du -bcs /var/lib/postgresql/14/main/ - -cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' | - awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' diff --git a/timescaledb-compressed/results/c6a.4xlarge.json b/timescaledb-compressed/results/c6a.4xlarge.json deleted file mode 100644 index 457038eb5..000000000 --- a/timescaledb-compressed/results/c6a.4xlarge.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "system": "TimescaleDB (compression)", - "date": "2022-07-01", - "machine": "c6a.4xlarge, 500gb gp2", - "cluster_size": 1, - "comment": "", - - "tags": ["C", "PostgreSQL compatible", "column-oriented", "time-series"], - - "load_time": 4605, - "data_size": 20333747165, - - "result": [ -[2.28686,1.63642,1.64263], -[32.6848,1.63476,1.40052], -[60.8633,3.70484,3.59342], -[36.4029,2.87091,2.80739], -[110.391,38.9688,38.0549], -[147.379,66.2513,65.6379], -[33.0294,2.92031,2.84375], -[33.0221,1.2984,1.19227], -[115.694,47.4651,47.0125], -[156.347,51.577,51.2694], -[68.3301,4.75521,4.68007], -[77.4356,5.55128,5.56577], -[49.7741,11.2911,11.3265], -[81.1014,14.9111,14.9541], -[82.9569,14.6156,14.6331], -[62.0338,26.399,26.3351], -[103.259,36.4122,36.6076], -[92.8828,26.2395,25.8991], -[144.281,63.5102,63.7661], -[7.00679,0.573073,0.536283], -[75.0203,7.86344,7.90495], -[81.2825,9.15868,9.01775], -[104.084,13.9528,13.8435], -[132.531,81.522,82.1561], -[80.6965,3.28231,3.16574], -[39.7693,2.51443,2.43849], -[80.4245,3.26941,3.13916], -[104.015,13.7044,13.5313], -[307.26,253.127,252.147], -[42.8549,22.4187,22.0325], -[137.601,14.9592,14.6804], -[136.767,22.8007,22.131], -[263.005,168.551,163.355], -[156.919,92.6308,91.702], -[160.842,96.0512,97.1773], -[62.8357,28.0336,28.7397], -[1.75869,0.561604,0.541215], -[0.46607,0.191863,0.19021], -[0.303671,0.137579,0.136615], -[2.32031,1.49223,1.52369], -[0.563764,0.14192,0.138234], -[0.372428,0.122989,0.123709], -[0.448574,0.159092,0.154687] -] -} diff --git a/timescaledb-no-columnstore/benchmark.sh b/timescaledb-no-columnstore/benchmark.sh new file mode 100755 index 000000000..7e2ff5cb6 --- /dev/null +++ b/timescaledb-no-columnstore/benchmark.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +# Install + +export DEBIAN_FRONTEND=noninteractive +sudo apt-get update +sudo apt-get install -y gnupg postgresql-common apt-transport-https lsb-release wget +sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y +sudo bash -c 'echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list' +wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - +sudo apt-get update +sudo apt install -y timescaledb-2-postgresql-17 postgresql-client-17 +sudo timescaledb-tune -yes +sudo systemctl restart postgresql + +sudo -u postgres psql -c "CREATE DATABASE nocolumnstore" +sudo -u postgres psql nocolumnstore -c "CREATE EXTENSION timescaledb WITH VERSION '2.17.2';" + +wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz' +gzip -d hits.tsv.gz +sudo chmod og+rX ~ +chmod 777 hits.tsv + +#import +sudo -u postgres psql nocolumnstore < create.sql +sudo -u postgres psql nocolumnstore -c "SELECT create_hypertable('hits', 'eventtime', chunk_time_interval => interval '3 day')" +sudo -u postgres psql nocolumnstore -c "CREATE INDEX ix_counterid ON hits (counterid)" +sudo -u postgres psql -c "ALTER DATABASE nocolumnstore SET work_mem TO '1GB';" +sudo -u postgres psql -c "ALTER DATABASE nocolumnstore SET min_parallel_table_scan_size TO '0';" + +sudo -u postgres psql nocolumnstore -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'" +sudo -u postgres psql nocolumnstore -t -c '\timing' -c "vacuum freeze analyze hits;" + +#datasize +sudo -u postgres psql nocolumnstore -c "\t" -c "SELECT hypertable_size('hits');" + +./run.sh 2>&1 | tee log.txt + +cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' | + awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' diff --git a/timescaledb-compressed/create.sql b/timescaledb-no-columnstore/create.sql similarity index 100% rename from timescaledb-compressed/create.sql rename to timescaledb-no-columnstore/create.sql diff --git a/timescaledb-compressed/queries.sql b/timescaledb-no-columnstore/queries.sql similarity index 100% rename from timescaledb-compressed/queries.sql rename to timescaledb-no-columnstore/queries.sql diff --git a/timescaledb-no-columnstore/results/c6a.4xlarge.json b/timescaledb-no-columnstore/results/c6a.4xlarge.json new file mode 100644 index 000000000..1d252ef90 --- /dev/null +++ b/timescaledb-no-columnstore/results/c6a.4xlarge.json @@ -0,0 +1,59 @@ +{ + "system": "TimescaleDB (no columnstore)", + "machine": "c6a.4xlarge, 500gb gp2", + "cluster_size": 1, + "comment": "", + "tags": [ + "C", + "PostgreSQL compatible", + "row-oriented", + "time-series" + ], + "load_time": 2633, + "data_size": 72021778432, + "result": [ +[0.825759, 0.795017, 0.79407], +[262.68, 248.867, 248.585], +[258.451, 248.351, 248.325], +[258.379, 248.281, 248.262], +[275.418, 264.224, 263.995], +[280.869, 270.926, 270.091], +[258.175, 248.071, 248.046], +[258.111, 248.006, 247.977], +[288.051, 277.948, 277.788], +[290.165, 281.137, 281.095], +[259.547, 248.679, 248.555], +[259.714, 248.728, 248.66], +[267.949, 257.085, 256.911], +[269.134, 258.08, 258.368], +[269.013, 258.061, 258.173], +[284.455, 273.874, 273.497], +[326.982, 314.428, 314.388], +[312.693, 301.501, 305.346], +[385.588, 375.142, 361.127], +[257.505, 247.396, 247.374], +[257.456, 247.333, 247.304], +[257.384, 247.258, 247.245], +[257.301, 247.155, 247.16], +[0.290002, 0.26618, 0.266557], +[0.028196, 0.005748, 0.005692], +[257.227, 247.116, 247.091], +[0.029594, 0.005812, 0.00571], +[257.177, 247.068, 247.028], +[271.838, 260.902, 261.47], +[257.088, 246.934, 246.867], +[279.554, 269.624, 269.901], +[293.384, 280.375, 283.582], +[475.407, 453.481, 451.233], +[361.092, 349.146, 352.018], +[358.697, 356.885, 351.725], +[282.44, 273.055, 272.881], +[5.86585, 0.981175, 0.98396], +[0.751076, 0.724599, 0.724766], +[0.167832, 0.141113, 0.141385], +[1.8474, 1.80169, 1.7934], +[0.212307, 0.184387, 0.18482], +[0.20732, 0.175064, 0.175146], +[0.728829, 0.705309, 0.705701] + ] +} diff --git a/timescaledb-compressed/run.sh b/timescaledb-no-columnstore/run.sh similarity index 68% rename from timescaledb-compressed/run.sh rename to timescaledb-no-columnstore/run.sh index 198ab5461..0e5bec0a9 100755 --- a/timescaledb-compressed/run.sh +++ b/timescaledb-no-columnstore/run.sh @@ -8,6 +8,6 @@ cat queries.sql | while read query; do echo "$query"; for i in $(seq 1 $TRIES); do - psql test -t -c '\timing' -c "$query" | grep 'Time' + sudo -u postgres psql nocolumnstore -t -c '\timing' -c "$query" | grep 'Time' done; done; diff --git a/timescaledb/benchmark.sh b/timescaledb/benchmark.sh old mode 100755 new mode 100644 index 35ea1a7b3..3f061f62d --- a/timescaledb/benchmark.sh +++ b/timescaledb/benchmark.sh @@ -1,41 +1,48 @@ #!/bin/bash # Install - export DEBIAN_FRONTEND=noninteractive sudo apt-get update sudo apt-get install -y gnupg postgresql-common apt-transport-https lsb-release wget -sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh +sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y sudo bash -c 'echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list' wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add - sudo apt-get update -sudo apt-get install -y timescaledb-2-postgresql-14 -sudo bash -c "echo \"shared_preload_libraries = 'timescaledb'\" >> /etc/postgresql/14/main/postgresql.conf" +sudo apt install -y timescaledb-2-postgresql-17 postgresql-client-17 +sudo timescaledb-tune -yes + sudo systemctl restart postgresql -sudo -u postgres psql -c "CREATE DATABASE uncompressed" -sudo -u postgres psql uncompressed -c "CREATE EXTENSION IF NOT EXISTS timescaledb" +sudo -u postgres psql -c "CREATE DATABASE test" +sudo -u postgres psql test -c "CREATE EXTENSION timescaledb WITH VERSION '2.17.2';" # Import the data - wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz' gzip -d hits.tsv.gz sudo chmod og+rX ~ chmod 777 hits.tsv -sudo -u postgres psql uncompressed < create.sql -sudo -u postgres psql uncompressed -c "SELECT create_hypertable('hits', 'eventtime')" -sudo -u postgres psql uncompressed -c "CREATE INDEX ix_counterid ON hits (counterid)" -sudo -u postgres psql uncompressed -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_orderby = 'counterid, eventdate, userid, eventtime')" -sudo -u postgres psql uncompressed -c "SELECT add_compression_policy('hits', INTERVAL '1s')" +sudo -u postgres psql test < create.sql +sudo -u postgres psql test -c "SELECT create_hypertable('hits', 'eventtime', chunk_time_interval => interval '3 day', create_default_indexes => false)" +sudo -u postgres psql test -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_segmentby = '', timescaledb.compress_orderby = 'counterid, userid, eventtime')" +sudo -u postgres psql test -c "ALTER DATABASE test SET timescaledb.enable_chunk_skipping to ON;" +sudo -u postgres psql -c "ALTER DATABASE test SET work_mem TO '1GB';" +sudo -u postgres psql -c "ALTER DATABASE test SET min_parallel_table_scan_size TO '0';" +sudo -u postgres psql test -c "SELECT enable_chunk_skipping('hits', 'counterid');" -sudo -u postgres psql uncompressed -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'" +sudo -u postgres psql test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'" -# 1619875.288 ms (26:59.875) +# See https://github.com/timescale/timescaledb/issues/4473#issuecomment-1167095245 +# https://docs.timescale.com/timescaledb/latest/how-to-guides/compression/manually-compress-chunks/#compress-chunks-manually +# TimescaleDB benchmark wihout compression is available in timescaledb no columnstore directory -./run.sh 2>&1 | tee log.txt +sudo -u postgres psql test -c "SELECT compress_chunk(i, if_not_compressed => true) FROM show_chunks('hits') i" +sudo -u postgres psql test -t -c '\timing' -c "vacuum freeze analyze hits;" + +#datasize +sudo -u postgres psql test -c "\t" -c "SELECT hypertable_size('hits');" -sudo du -bcs /var/lib/postgresql/14/main/ +./run.sh 2>&1 | tee log.txt cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' | awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' diff --git a/timescaledb/results/c6a.4xlarge.json b/timescaledb/results/c6a.4xlarge.json index 63d57a749..8159dbad3 100644 --- a/timescaledb/results/c6a.4xlarge.json +++ b/timescaledb/results/c6a.4xlarge.json @@ -1,58 +1,60 @@ { - "system": "TimescaleDB", - "date": "2022-07-01", - "machine": "c6a.4xlarge, 500gb gp2", - "cluster_size": 1, - "comment": "", - - "tags": ["C", "PostgreSQL compatible", "row-oriented", "time-series"], - - "load_time": 1620, - "data_size": 72882392030, - - "result": [ -[437.700,215.793,176.420], -[327.026,259.568,244.578], -[262.978,263.090,263.083], -[262.807,263.046,266.847], -[337.497,334.964,330.852], -[355.689,356.801,362.894], -[262.762,263.012,262.968], -[263.055,263.016,263.028], -[319.928,319.388,320.704], -[323.584,322.224,322.488], -[265.979,265.465,265.375], -[266.019,265.543,265.462], -[277.018,276.300,276.595], -[280.352,279.251,279.572], -[279.915,279.896,279.674], -[296.377,298.506,297.659], -[314.448,314.605,312.570], -[302.668,302.672,303.039], -[325.810,324.061,324.376], -[262.447,262.698,262.704], -[267.581,267.467,267.482], -[268.085,267.466,267.696], -[263.391,263.097,263.126], -[38.291,0.435,0.335], -[0.127,0.005,0.005], -[263.138,263.100,263.092], -[0.889,0.341,0.339], -[267.586,267.498,267.491], -[289.086,290.012,290.093], -[263.220,263.071,263.109], -[274.780,273.995,273.998], -[282.217,281.390,281.470], -[429.273,426.588,439.431], -[448.808,418.724,418.207], -[455.196,422.750,423.142], -[299.263,296.937,297.261], -[18.693,1.552,1.481], -[18.125,0.945,0.937], -[18.528,1.062,0.902], -[18.268,1.779,1.770], -[19.615,1.965,1.966], -[18.970,1.435,1.430], -[18.330,1.153,0.952] -] + "system": "TimescaleDB", + "date": "2024-11-12", + "machine": "c6a.4xlarge, 500gb gp2", + "cluster_size": 1, + "comment": "", + "tags": [ + "C", + "PostgreSQL compatible", + "column-oriented", + "time-series" + ], + "load_time": 2925, + "data_size": 19304833024, + "result": [ +[0.235548, 0.036099, 0.036163], +[19.7933, 0.169001, 0.168361], +[18.9245, 0.247457, 0.246337], +[21.9931, 0.20608, 0.205977], +[10.682, 10.2227, 10.1876], +[37.9536, 15.4292, 15.2575], +[9.1745, 0.173641, 0.175963], +[0.230673, 0.186469, 0.186658], +[31.7209, 19.9927, 19.9604], +[22.8619, 22.7002, 22.6094], +[7.48437, 1.77802, 1.79897], +[6.61606, 2.31768, 2.41576], +[13.6664, 5.51914, 5.53991], +[8.24705, 8.01542, 8.00718], +[13.5789, 6.52172, 6.55581], +[13.9546, 14.1044, 13.9579], +[24.4316, 24.3629, 24.7242], +[13.2509, 13.1415, 12.9678], +[76.6103, 58.951, 59.1555], +[0.190042, 0.155834, 0.155095], +[61.4993, 3.42105, 1.43345], +[1.47164, 1.44235, 1.44143], +[72.3975, 1.63576, 1.60404], +[0.255848, 0.079533, 0.079303], +[0.449811, 0.043526, 0.044307], +[13.2346, 0.411303, 0.407034], +[0.072324, 0.043998, 0.044456], +[22.342, 4.22788, 4.17213], +[65.9515, 33.8073, 34.0337], +[26.7949, 12.0366, 11.9864], +[97.3602, 7.56289, 7.14007], +[52.8152, 15.1488, 15.1431], +[142.318, 142.004, 140.552], +[75.0637, 28.5268, 28.8399], +[29.8478, 29.4829, 29.1753], +[11.1359, 11.3287, 11.3091], +[0.325518, 0.259915, 0.260927], +[0.132595, 0.064657, 0.065113], +[0.090194, 0.038158, 0.039605], +[0.731474, 0.538372, 0.542066], +[0.156162, 0.042762, 0.044043], +[0.076735, 0.031384, 0.031414], +[0.126314, 0.041685, 0.041164] + ] } diff --git a/timescaledb/run.sh b/timescaledb/run.sh index 84edae1f3..ad95151ab 100755 --- a/timescaledb/run.sh +++ b/timescaledb/run.sh @@ -8,6 +8,6 @@ cat queries.sql | while read query; do echo "$query"; for i in $(seq 1 $TRIES); do - sudo -u postgres psql uncompressed -t -c '\timing' -c "$query" | grep 'Time' + sudo -u postgres psql test -t -c '\timing' -c "$query" | grep 'Time' done; done;