Skip to content

Commit

Permalink
Updated results for TimescaleDB 2.17
Browse files Browse the repository at this point in the history
- Update TimescaleDB to include Compression as the default
  TimescaleDB setup.
- Move uncompressed to "TimescaleDB (No Columnstore)"
  • Loading branch information
matthewmcnew committed Nov 14, 2024
1 parent 39afd23 commit 269bcdb
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 180 deletions.
48 changes: 0 additions & 48 deletions timescaledb-compressed/benchmark.sh

This file was deleted.

58 changes: 0 additions & 58 deletions timescaledb-compressed/results/c6a.4xlarge.json

This file was deleted.

40 changes: 40 additions & 0 deletions timescaledb-no-columnstore/benchmark.sh
Original file line number Diff line number Diff line change
@@ -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; }'
File renamed without changes.
File renamed without changes.
59 changes: 59 additions & 0 deletions timescaledb-no-columnstore/results/c6a.4xlarge.json
Original file line number Diff line number Diff line change
@@ -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]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
39 changes: 23 additions & 16 deletions timescaledb/benchmark.sh
100755 → 100644
Original file line number Diff line number Diff line change
@@ -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; }'
114 changes: 58 additions & 56 deletions timescaledb/results/c6a.4xlarge.json
Original file line number Diff line number Diff line change
@@ -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]
]
}
Loading

0 comments on commit 269bcdb

Please sign in to comment.