Skip to content

Commit c3847f8

Browse files
qoegaalexey-milovidov
authored andcommitted
Separate compress timescaledb test. Fix chmod to home - previous broke ssh. Non interactive install.
1 parent 7a9a180 commit c3847f8

File tree

7 files changed

+224
-18
lines changed

7 files changed

+224
-18
lines changed

timescaledb-compressed/benchmark.sh

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
3+
# Install
4+
export DEBIAN_FRONTEND=noninteractive
5+
sudo apt-get update
6+
sudo apt-get install -y gnupg postgresql-common apt-transport-https lsb-release wget
7+
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
8+
sudo bash -c 'echo "deb https://packagecloud.io/timescale/timescaledb/ubuntu/ $(lsb_release -c -s) main" > /etc/apt/sources.list.d/timescaledb.list'
9+
wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | sudo apt-key add -
10+
sudo apt-get update
11+
sudo apt-get install -y timescaledb-2-postgresql-14
12+
sudo bash -c "echo \"shared_preload_libraries = 'timescaledb'\" >> /etc/postgresql/14/main/postgresql.conf"
13+
sudo systemctl restart postgresql
14+
15+
sudo -u postgres psql -c "CREATE DATABASE test"
16+
sudo -u postgres psql test -c "CREATE EXTENSION IF NOT EXISTS timescaledb"
17+
18+
# Import the data
19+
20+
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
21+
gzip -d hits.tsv.gz
22+
sudo chmod og+rX ~
23+
chmod 777 hits.tsv
24+
25+
sudo -u postgres psql test < create.sql
26+
sudo -u postgres psql test -c "SELECT create_hypertable('hits', 'eventtime')"
27+
sudo -u postgres psql test -c "CREATE INDEX ix_counterid ON hits (counterid)"
28+
sudo -u postgres psql test -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_orderby = 'counterid, eventdate, userid, eventtime')"
29+
sudo -u postgres psql test -c "SELECT add_compression_policy('hits', INTERVAL '1s')"
30+
31+
sudo -u postgres psql test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
32+
33+
# 1619875.288 ms (26:59.875)
34+
35+
# See https://github.com/timescale/timescaledb/issues/4473#issuecomment-1167095245
36+
# https://docs.timescale.com/timescaledb/latest/how-to-guides/compression/manually-compress-chunks/#compress-chunks-manually
37+
# TimescaleDB benchmark wihout compression is available in timescaledb directory
38+
39+
time sudo -u postgres psql test -c "SELECT compress_chunk(i, if_not_compressed => true) FROM show_chunks('hits') i"
40+
41+
# 49m45.120s
42+
43+
./run.sh 2>&1 | tee log.txt
44+
45+
sudo du -bcs /var/lib/postgresql/14/main/
46+
47+
cat log.txt | grep -oP 'Time: \d+\.\d+ ms' | sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/' |
48+
awk '{ if (i % 3 == 0) { printf "[" }; printf $1 / 1000; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }'

timescaledb-compressed/create.sql

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
CREATE TABLE hits
2+
(
3+
WatchID BIGINT NOT NULL,
4+
JavaEnable SMALLINT NOT NULL,
5+
Title TEXT NOT NULL,
6+
GoodEvent SMALLINT NOT NULL,
7+
EventTime TIMESTAMP NOT NULL,
8+
EventDate Date NOT NULL,
9+
CounterID INTEGER NOT NULL,
10+
ClientIP INTEGER NOT NULL,
11+
RegionID INTEGER NOT NULL,
12+
UserID BIGINT NOT NULL,
13+
CounterClass SMALLINT NOT NULL,
14+
OS SMALLINT NOT NULL,
15+
UserAgent SMALLINT NOT NULL,
16+
URL TEXT NOT NULL,
17+
Referer TEXT NOT NULL,
18+
IsRefresh SMALLINT NOT NULL,
19+
RefererCategoryID SMALLINT NOT NULL,
20+
RefererRegionID INTEGER NOT NULL,
21+
URLCategoryID SMALLINT NOT NULL,
22+
URLRegionID INTEGER NOT NULL,
23+
ResolutionWidth SMALLINT NOT NULL,
24+
ResolutionHeight SMALLINT NOT NULL,
25+
ResolutionDepth SMALLINT NOT NULL,
26+
FlashMajor SMALLINT NOT NULL,
27+
FlashMinor SMALLINT NOT NULL,
28+
FlashMinor2 TEXT NOT NULL,
29+
NetMajor SMALLINT NOT NULL,
30+
NetMinor SMALLINT NOT NULL,
31+
UserAgentMajor SMALLINT NOT NULL,
32+
UserAgentMinor VARCHAR(255) NOT NULL,
33+
CookieEnable SMALLINT NOT NULL,
34+
JavascriptEnable SMALLINT NOT NULL,
35+
IsMobile SMALLINT NOT NULL,
36+
MobilePhone SMALLINT NOT NULL,
37+
MobilePhoneModel TEXT NOT NULL,
38+
Params TEXT NOT NULL,
39+
IPNetworkID INTEGER NOT NULL,
40+
TraficSourceID SMALLINT NOT NULL,
41+
SearchEngineID SMALLINT NOT NULL,
42+
SearchPhrase TEXT NOT NULL,
43+
AdvEngineID SMALLINT NOT NULL,
44+
IsArtifical SMALLINT NOT NULL,
45+
WindowClientWidth SMALLINT NOT NULL,
46+
WindowClientHeight SMALLINT NOT NULL,
47+
ClientTimeZone SMALLINT NOT NULL,
48+
ClientEventTime TIMESTAMP NOT NULL,
49+
SilverlightVersion1 SMALLINT NOT NULL,
50+
SilverlightVersion2 SMALLINT NOT NULL,
51+
SilverlightVersion3 INTEGER NOT NULL,
52+
SilverlightVersion4 SMALLINT NOT NULL,
53+
PageCharset TEXT NOT NULL,
54+
CodeVersion INTEGER NOT NULL,
55+
IsLink SMALLINT NOT NULL,
56+
IsDownload SMALLINT NOT NULL,
57+
IsNotBounce SMALLINT NOT NULL,
58+
FUniqID BIGINT NOT NULL,
59+
OriginalURL TEXT NOT NULL,
60+
HID INTEGER NOT NULL,
61+
IsOldCounter SMALLINT NOT NULL,
62+
IsEvent SMALLINT NOT NULL,
63+
IsParameter SMALLINT NOT NULL,
64+
DontCountHits SMALLINT NOT NULL,
65+
WithHash SMALLINT NOT NULL,
66+
HitColor CHAR NOT NULL,
67+
LocalEventTime TIMESTAMP NOT NULL,
68+
Age SMALLINT NOT NULL,
69+
Sex SMALLINT NOT NULL,
70+
Income SMALLINT NOT NULL,
71+
Interests SMALLINT NOT NULL,
72+
Robotness SMALLINT NOT NULL,
73+
RemoteIP INTEGER NOT NULL,
74+
WindowName INTEGER NOT NULL,
75+
OpenerName INTEGER NOT NULL,
76+
HistoryLength SMALLINT NOT NULL,
77+
BrowserLanguage TEXT NOT NULL,
78+
BrowserCountry TEXT NOT NULL,
79+
SocialNetwork TEXT NOT NULL,
80+
SocialAction TEXT NOT NULL,
81+
HTTPError SMALLINT NOT NULL,
82+
SendTiming INTEGER NOT NULL,
83+
DNSTiming INTEGER NOT NULL,
84+
ConnectTiming INTEGER NOT NULL,
85+
ResponseStartTiming INTEGER NOT NULL,
86+
ResponseEndTiming INTEGER NOT NULL,
87+
FetchTiming INTEGER NOT NULL,
88+
SocialSourceNetworkID SMALLINT NOT NULL,
89+
SocialSourcePage TEXT NOT NULL,
90+
ParamPrice BIGINT NOT NULL,
91+
ParamOrderID TEXT NOT NULL,
92+
ParamCurrency TEXT NOT NULL,
93+
ParamCurrencyID SMALLINT NOT NULL,
94+
OpenstatServiceName TEXT NOT NULL,
95+
OpenstatCampaignID TEXT NOT NULL,
96+
OpenstatAdID TEXT NOT NULL,
97+
OpenstatSourceID TEXT NOT NULL,
98+
UTMSource TEXT NOT NULL,
99+
UTMMedium TEXT NOT NULL,
100+
UTMCampaign TEXT NOT NULL,
101+
UTMContent TEXT NOT NULL,
102+
UTMTerm TEXT NOT NULL,
103+
FromTag TEXT NOT NULL,
104+
HasGCLID SMALLINT NOT NULL,
105+
RefererHash BIGINT NOT NULL,
106+
URLHash BIGINT NOT NULL,
107+
CLID INTEGER NOT NULL
108+
);

timescaledb-compressed/queries.sql

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
SELECT COUNT(*) FROM hits;
2+
SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0;
3+
SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits;
4+
SELECT AVG(UserID) FROM hits;
5+
SELECT COUNT(DISTINCT UserID) FROM hits;
6+
SELECT COUNT(DISTINCT SearchPhrase) FROM hits;
7+
SELECT MIN(EventDate), MAX(EventDate) FROM hits;
8+
SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC;
9+
SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10;
10+
SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10;
11+
SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10;
12+
SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10;
13+
SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10;
14+
SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10;
15+
SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10;
16+
SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10;
17+
SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10;
18+
SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10;
19+
SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10;
20+
SELECT UserID FROM hits WHERE UserID = 435090932899640449;
21+
SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%';
22+
SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10;
23+
SELECT SearchPhrase, MIN(URL), MIN(Title), COUNT(*) AS c, COUNT(DISTINCT UserID) FROM hits WHERE Title LIKE '%Google%' AND URL NOT LIKE '%.google.%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10;
24+
SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10;
25+
SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10;
26+
SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10;
27+
SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10;
28+
SELECT CounterID, AVG(length(URL)) AS l, COUNT(*) AS c FROM hits WHERE URL <> '' GROUP BY CounterID HAVING COUNT(*) > 100000 ORDER BY l DESC LIMIT 25;
29+
SELECT REGEXP_REPLACE(Referer, '^https?://(?:www\.)?([^/]+)/.*$', '\1') AS k, AVG(length(Referer)) AS l, COUNT(*) AS c, MIN(Referer) FROM hits WHERE Referer <> '' GROUP BY k HAVING COUNT(*) > 100000 ORDER BY l DESC LIMIT 25;
30+
SELECT SUM(ResolutionWidth), SUM(ResolutionWidth + 1), SUM(ResolutionWidth + 2), SUM(ResolutionWidth + 3), SUM(ResolutionWidth + 4), SUM(ResolutionWidth + 5), SUM(ResolutionWidth + 6), SUM(ResolutionWidth + 7), SUM(ResolutionWidth + 8), SUM(ResolutionWidth + 9), SUM(ResolutionWidth + 10), SUM(ResolutionWidth + 11), SUM(ResolutionWidth + 12), SUM(ResolutionWidth + 13), SUM(ResolutionWidth + 14), SUM(ResolutionWidth + 15), SUM(ResolutionWidth + 16), SUM(ResolutionWidth + 17), SUM(ResolutionWidth + 18), SUM(ResolutionWidth + 19), SUM(ResolutionWidth + 20), SUM(ResolutionWidth + 21), SUM(ResolutionWidth + 22), SUM(ResolutionWidth + 23), SUM(ResolutionWidth + 24), SUM(ResolutionWidth + 25), SUM(ResolutionWidth + 26), SUM(ResolutionWidth + 27), SUM(ResolutionWidth + 28), SUM(ResolutionWidth + 29), SUM(ResolutionWidth + 30), SUM(ResolutionWidth + 31), SUM(ResolutionWidth + 32), SUM(ResolutionWidth + 33), SUM(ResolutionWidth + 34), SUM(ResolutionWidth + 35), SUM(ResolutionWidth + 36), SUM(ResolutionWidth + 37), SUM(ResolutionWidth + 38), SUM(ResolutionWidth + 39), SUM(ResolutionWidth + 40), SUM(ResolutionWidth + 41), SUM(ResolutionWidth + 42), SUM(ResolutionWidth + 43), SUM(ResolutionWidth + 44), SUM(ResolutionWidth + 45), SUM(ResolutionWidth + 46), SUM(ResolutionWidth + 47), SUM(ResolutionWidth + 48), SUM(ResolutionWidth + 49), SUM(ResolutionWidth + 50), SUM(ResolutionWidth + 51), SUM(ResolutionWidth + 52), SUM(ResolutionWidth + 53), SUM(ResolutionWidth + 54), SUM(ResolutionWidth + 55), SUM(ResolutionWidth + 56), SUM(ResolutionWidth + 57), SUM(ResolutionWidth + 58), SUM(ResolutionWidth + 59), SUM(ResolutionWidth + 60), SUM(ResolutionWidth + 61), SUM(ResolutionWidth + 62), SUM(ResolutionWidth + 63), SUM(ResolutionWidth + 64), SUM(ResolutionWidth + 65), SUM(ResolutionWidth + 66), SUM(ResolutionWidth + 67), SUM(ResolutionWidth + 68), SUM(ResolutionWidth + 69), SUM(ResolutionWidth + 70), SUM(ResolutionWidth + 71), SUM(ResolutionWidth + 72), SUM(ResolutionWidth + 73), SUM(ResolutionWidth + 74), SUM(ResolutionWidth + 75), SUM(ResolutionWidth + 76), SUM(ResolutionWidth + 77), SUM(ResolutionWidth + 78), SUM(ResolutionWidth + 79), SUM(ResolutionWidth + 80), SUM(ResolutionWidth + 81), SUM(ResolutionWidth + 82), SUM(ResolutionWidth + 83), SUM(ResolutionWidth + 84), SUM(ResolutionWidth + 85), SUM(ResolutionWidth + 86), SUM(ResolutionWidth + 87), SUM(ResolutionWidth + 88), SUM(ResolutionWidth + 89) FROM hits;
31+
SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10;
32+
SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10;
33+
SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10;
34+
SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10;
35+
SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10;
36+
SELECT ClientIP, ClientIP - 1, ClientIP - 2, ClientIP - 3, COUNT(*) AS c FROM hits GROUP BY ClientIP, ClientIP - 1, ClientIP - 2, ClientIP - 3 ORDER BY c DESC LIMIT 10;
37+
SELECT URL, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND DontCountHits = 0 AND IsRefresh = 0 AND URL <> '' GROUP BY URL ORDER BY PageViews DESC LIMIT 10;
38+
SELECT Title, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND DontCountHits = 0 AND IsRefresh = 0 AND Title <> '' GROUP BY Title ORDER BY PageViews DESC LIMIT 10;
39+
SELECT URL, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND IsRefresh = 0 AND IsLink <> 0 AND IsDownload = 0 GROUP BY URL ORDER BY PageViews DESC LIMIT 10 OFFSET 1000;
40+
SELECT TraficSourceID, SearchEngineID, AdvEngineID, CASE WHEN (SearchEngineID = 0 AND AdvEngineID = 0) THEN Referer ELSE '' END AS Src, URL AS Dst, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND IsRefresh = 0 GROUP BY TraficSourceID, SearchEngineID, AdvEngineID, Src, Dst ORDER BY PageViews DESC LIMIT 10 OFFSET 1000;
41+
SELECT URLHash, EventDate, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND IsRefresh = 0 AND TraficSourceID IN (-1, 6) AND RefererHash = 3594120000172545465 GROUP BY URLHash, EventDate ORDER BY PageViews DESC LIMIT 10 OFFSET 100;
42+
SELECT WindowClientWidth, WindowClientHeight, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-01' AND EventDate <= '2013-07-31' AND IsRefresh = 0 AND DontCountHits = 0 AND URLHash = 2868770270353813622 GROUP BY WindowClientWidth, WindowClientHeight ORDER BY PageViews DESC LIMIT 10 OFFSET 10000;
43+
SELECT DATE_TRUNC('minute', EventTime) AS M, COUNT(*) AS PageViews FROM hits WHERE CounterID = 62 AND EventDate >= '2013-07-14' AND EventDate <= '2013-07-15' AND IsRefresh = 0 AND DontCountHits = 0 GROUP BY DATE_TRUNC('minute', EventTime) ORDER BY DATE_TRUNC('minute', EventTime) LIMIT 10 OFFSET 1000;

timescaledb-compressed/run.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
TRIES=3
4+
5+
cat queries.sql | while read query; do
6+
sync
7+
echo 3 | sudo tee /proc/sys/vm/drop_caches
8+
9+
echo "$query";
10+
for i in $(seq 1 $TRIES); do
11+
psql test -t -c '\timing' -c "$query" | grep 'Time'
12+
done;
13+
done;

timescaledb/benchmark.sh

+11-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# Install
44

5+
export DEBIAN_FRONTEND=noninteractive
56
sudo apt-get update
67
sudo apt-get install -y gnupg postgresql-common apt-transport-https lsb-release wget
78
sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
@@ -12,33 +13,26 @@ sudo apt-get install -y timescaledb-2-postgresql-14
1213
sudo bash -c "echo \"shared_preload_libraries = 'timescaledb'\" >> /etc/postgresql/14/main/postgresql.conf"
1314
sudo systemctl restart postgresql
1415

15-
sudo -u postgres psql -c "CREATE DATABASE test"
16-
sudo -u postgres psql test -c "CREATE EXTENSION IF NOT EXISTS timescaledb"
16+
sudo -u postgres psql -c "CREATE DATABASE uncompressed"
17+
sudo -u postgres psql uncompressed -c "CREATE EXTENSION IF NOT EXISTS timescaledb"
1718

1819
# Import the data
1920

2021
wget --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz'
2122
gzip -d hits.tsv.gz
22-
chmod 777 ~ hits.tsv
23+
sudo chmod og+rX ~
24+
chmod 777 hits.tsv
2325

24-
sudo -u postgres psql test < create.sql
25-
sudo -u postgres psql test -c "SELECT create_hypertable('hits', 'eventtime')"
26-
sudo -u postgres psql test -c "CREATE INDEX ix_counterid ON hits (counterid)"
27-
sudo -u postgres psql test -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_orderby = 'counterid, eventdate, userid, eventtime')"
28-
sudo -u postgres psql test -c "SELECT add_compression_policy('hits', INTERVAL '1s')"
26+
sudo -u postgres psql uncompressed < create.sql
27+
sudo -u postgres psql uncompressed -c "SELECT create_hypertable('hits', 'eventtime')"
28+
sudo -u postgres psql uncompressed -c "CREATE INDEX ix_counterid ON hits (counterid)"
29+
sudo -u postgres psql uncompressed -c "ALTER TABLE hits SET (timescaledb.compress, timescaledb.compress_orderby = 'counterid, eventdate, userid, eventtime')"
30+
sudo -u postgres psql uncompressed -c "SELECT add_compression_policy('hits', INTERVAL '1s')"
2931

30-
sudo -u postgres psql test -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
32+
sudo -u postgres psql uncompressed -t -c '\timing' -c "\\copy hits FROM 'hits.tsv'"
3133

3234
# 1619875.288 ms (26:59.875)
3335

34-
# See https://github.com/timescale/timescaledb/issues/4473#issuecomment-1167095245
35-
# https://docs.timescale.com/timescaledb/latest/how-to-guides/compression/manually-compress-chunks/#compress-chunks-manually
36-
# Omit this step to proceed without compression.
37-
38-
time sudo -u postgres psql test -c "SELECT compress_chunk(i, if_not_compressed => true) FROM show_chunks('hits') i"
39-
40-
# 49m45.120s
41-
4236
./run.sh 2>&1 | tee log.txt
4337

4438
sudo du -bcs /var/lib/postgresql/14/main/

timescaledb/run.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ cat queries.sql | while read query; do
88

99
echo "$query";
1010
for i in $(seq 1 $TRIES); do
11-
sudo -u postgres psql test -t -c '\timing' -c "$query" | grep 'Time'
11+
sudo -u postgres psql uncompressed -t -c '\timing' -c "$query" | grep 'Time'
1212
done;
1313
done;

0 commit comments

Comments
 (0)