diff --git a/clickhouse-i114640-a/benchmark.sh b/clickhouse-i114640-a/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-a/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-a/check b/clickhouse-i114640-a/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-a/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-a/create.sql b/clickhouse-i114640-a/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-a/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-a/data-size b/clickhouse-i114640-a/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-a/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-a/install b/clickhouse-i114640-a/install new file mode 100755 index 0000000000..b65e6ab25f --- /dev/null +++ b/clickhouse-i114640-a/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned release build for the A/B investigation of +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# v26.5.6.113 anchor (last minor before the suspect window; expected fast on Q10/Q11). +VERSION=26.5.6.113 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o ch.tgz \ + "https://github.com/ClickHouse/ClickHouse/releases/download/v${VERSION}-stable/clickhouse-common-static-${VERSION}-amd64.tgz" + tar -xzf ch.tgz + sudo "./clickhouse-common-static-${VERSION}/usr/bin/clickhouse" install --noninteractive + rm -rf ch.tgz "clickhouse-common-static-${VERSION}" +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-a/load b/clickhouse-i114640-a/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-a/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-a/queries.sql b/clickhouse-i114640-a/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-a/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-a/query b/clickhouse-i114640-a/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-a/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-a/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-a/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..48c7d7deae --- /dev/null +++ b/clickhouse-i114640-a/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 26.5.6.113)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 254, + "data_size": 15268657418, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.001, 0.001], + [0.121, 0.01, 0.01], + [0.417, 0.027, 0.012], + [0.919, 0.012, 0.012], + [1.003, 0.075, 0.063], + [1.848, 0.102, 0.082], + [0.143, 0.009, 0.01], + [0.146, 0.016, 0.045], + [1.612, 0.288, 0.226], + [1.919, 0.264, 0.298], + [1.215, 0.13, 0.113], + [1.318, 0.097, 0.11], + [1.815, 0.136, 0.115], + [2.703, 0.142, 0.121], + [1.994, 0.086, 0.076], + [0.976, 0.075, 0.06], + [2.626, 0.15, 0.147], + [2.631, 0.137, 0.116], + [4.049, 0.272, 0.268], + [0.707, 0.002, 0.003], + [9.464, 0.052, 0.054], + [10.968, 0.04, 0.039], + [13.838, 0.089, 0.084], + [5.269, 0.088, 0.073], + [1.911, 0.198, 0.08], + [1.762, 0.033, 0.03], + [1.929, 0.67, 0.058], + [1.162, 0.044, 0.088], + [8.254, 0.766, 0.752], + [0.501, 0.121, 0.065], + [1.635, 0.084, 0.064], + [3.92, 0.09, 0.095], + [3.918, 0.444, 0.364], + [10.579, 0.371, 0.305], + [9.718, 0.363, 0.311], + [0.741, 0.06, 0.043], + [0.733, 0.054, 0.06], + [0.411, 0.047, 0.044], + [0.778, 0.046, 0.026], + [1.232, 0.114, 0.1], + [0.425, 0.028, 0.037], + [0.356, 0.026, 0.012], + [0.259, 0.021, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-a/start b/clickhouse-i114640-a/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-a/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-a/stop b/clickhouse-i114640-a/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-a/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-a/template.json b/clickhouse-i114640-a/template.json new file mode 100644 index 0000000000..d77d75b4d0 --- /dev/null +++ b/clickhouse-i114640-a/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 26.5.6.113)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-daily/benchmark.sh b/clickhouse-i114640-daily/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-daily/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-daily/check b/clickhouse-i114640-daily/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-daily/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-daily/create.sql b/clickhouse-i114640-daily/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-daily/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-daily/data-size b/clickhouse-i114640-daily/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-daily/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-daily/install b/clickhouse-i114640-daily/install new file mode 100755 index 0000000000..46fa3da1f5 --- /dev/null +++ b/clickhouse-i114640-daily/install @@ -0,0 +1,38 @@ +#!/bin/bash +set -e -o pipefail + +# Round 3 CONTROL for https://github.com/ClickHouse/ClickHouse/issues/114640: +# the EXACT install the daily mainline runs use (universal script = current +# master CDN artifact). Expected to reproduce the Q11 slow mode. +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 60 --retry-all-errors https://clickhouse.com/ | sh + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-daily/load b/clickhouse-i114640-daily/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-daily/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-daily/queries.sql b/clickhouse-i114640-daily/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-daily/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-daily/query b/clickhouse-i114640-daily/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-daily/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-daily/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-daily/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..52a53943f5 --- /dev/null +++ b/clickhouse-i114640-daily/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 daily-master CDN)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 259, + "data_size": 15266678705, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.002, 0.001], + [0.002, 0.002, 0.002], + [0.414, 0.022, 0.014], + [0.986, 0.027, 0.024], + [1.039, 0.07, 0.078], + [1.991, 0.078, 0.098], + [0.106, 0.01, 0.01], + [0.138, 0.016, 0.018], + [1.664, 0.225, 0.22], + [1.888, 0.26, 0.224], + [1.419, 0.187, 0.213], + [1.599, 0.193, 0.222], + [1.859, 0.074, 0.071], + [2.838, 0.116, 0.098], + [2.082, 0.085, 0.081], + [0.998, 0.067, 0.057], + [2.826, 0.148, 0.148], + [2.713, 0.154, 0.131], + [4.219, 0.267, 0.281], + [0.951, 0.003, 0.003], + [9.529, 0.057, 0.047], + [11.013, 0.023, 0.023], + [13.815, 0.064, 0.059], + [5.694, 0.287, 0.261], + [1.999, 0.197, 0.178], + [1.809, 0.033, 0.035], + [1.899, 0.881, 0.165], + [1.215, 0.032, 0.024], + [8.559, 0.195, 0.189], + [0.469, 0.037, 0.036], + [1.624, 0.067, 0.059], + [3.84, 0.11, 0.068], + [3.873, 0.364, 0.36], + [10.018, 0.31, 0.299], + [9.821, 0.308, 0.282], + [0.682, 0.055, 0.048], + [0.925, 0.047, 0.047], + [0.459, 0.025, 0.021], + [0.928, 0.02, 0.021], + [1.517, 0.118, 0.101], + [0.542, 0.014, 0.014], + [0.507, 0.027, 0.01], + [0.344, 0.021, 0.007] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-daily/start b/clickhouse-i114640-daily/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-daily/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-daily/stop b/clickhouse-i114640-daily/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-daily/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-daily/template.json b/clickhouse-i114640-daily/template.json new file mode 100644 index 0000000000..07a9c6d3cb --- /dev/null +++ b/clickhouse-i114640-daily/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 daily-master CDN)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-fix/benchmark.sh b/clickhouse-i114640-fix/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-fix/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-fix/check b/clickhouse-i114640-fix/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-fix/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-fix/create.sql b/clickhouse-i114640-fix/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-fix/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-fix/data-size b/clickhouse-i114640-fix/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-fix/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-fix/install b/clickhouse-i114640-fix/install new file mode 100755 index 0000000000..f9a5e647b4 --- /dev/null +++ b/clickhouse-i114640-fix/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Validation round for https://github.com/ClickHouse/ClickHouse/pull/114691: +# the CI build of the fix (parallelize single->two-level conversion in +# Aggregator::prepareVariantsToMerge). Expected: Q10/Q11 back to ~0.09-0.13 +# on c7a.metal-48xl while current master dailies show 0.16-0.39. +SHA=2a9e54c7201e63b269eaba0f3fd2ec9d3558109a + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/PRs/114691/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-fix/load b/clickhouse-i114640-fix/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-fix/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-fix/queries.sql b/clickhouse-i114640-fix/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-fix/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-fix/query b/clickhouse-i114640-fix/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-fix/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-fix/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-fix/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..a7e7eff19e --- /dev/null +++ b/clickhouse-i114640-fix/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 fix PR 114691)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 274, + "data_size": 15259162182, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.001, 0.001, 0.001], + [0.373, 0.013, 0.013], + [0.957, 0.012, 0.012], + [1.121, 0.066, 0.065], + [1.888, 0.08, 0.074], + [0.103, 0.01, 0.01], + [0.152, 0.019, 0.016], + [1.629, 0.245, 0.249], + [1.897, 0.233, 0.222], + [1.299, 0.105, 0.096], + [1.333, 0.124, 0.097], + [1.872, 0.083, 0.067], + [2.759, 0.109, 0.098], + [2.09, 0.088, 0.076], + [1.022, 0.065, 0.065], + [2.741, 0.147, 0.142], + [2.822, 0.125, 0.119], + [4.39, 0.265, 0.26], + [0.66, 0.003, 0.002], + [9.568, 0.061, 0.051], + [11.08, 0.024, 0.024], + [13.783, 0.061, 0.063], + [4.225, 0.379, 0.383], + [2.12, 0.193, 0.102], + [1.898, 0.035, 0.032], + [2.001, 0.748, 0.161], + [1.217, 0.031, 0.024], + [8.722, 0.202, 0.194], + [0.431, 0.037, 0.036], + [1.607, 0.074, 0.078], + [3.86, 0.094, 0.074], + [3.864, 0.353, 0.358], + [10.043, 0.314, 0.275], + [9.766, 0.308, 0.278], + [0.709, 0.064, 0.044], + [0.581, 0.066, 0.021], + [0.386, 0.033, 0.013], + [0.644, 0.032, 0.013], + [0.929, 0.046, 0.044], + [0.366, 0.025, 0.01], + [0.354, 0.027, 0.008], + [0.258, 0.025, 0.008] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-fix/start b/clickhouse-i114640-fix/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-fix/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-fix/stop b/clickhouse-i114640-fix/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-fix/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-fix/template.json b/clickhouse-i114640-fix/template.json new file mode 100644 index 0000000000..99d00e5dde --- /dev/null +++ b/clickhouse-i114640-fix/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 fix PR 114691)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-m0618/benchmark.sh b/clickhouse-i114640-m0618/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-m0618/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-m0618/check b/clickhouse-i114640-m0618/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-m0618/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-m0618/create.sql b/clickhouse-i114640-m0618/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-m0618/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-m0618/data-size b/clickhouse-i114640-m0618/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-m0618/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-m0618/install b/clickhouse-i114640-m0618/install new file mode 100755 index 0000000000..38d6f37d76 --- /dev/null +++ b/clickhouse-i114640-m0618/install @@ -0,0 +1,42 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build, round 2 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# master @ 2026-06-18 (inside the 06-13..06-23 window). +SHA=0ea5338b83a06aada8cc39853386f300aee066da + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-m0618/load b/clickhouse-i114640-m0618/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-m0618/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-m0618/queries.sql b/clickhouse-i114640-m0618/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-m0618/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-m0618/query b/clickhouse-i114640-m0618/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-m0618/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-m0618/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-m0618/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..9b92d90b65 --- /dev/null +++ b/clickhouse-i114640-m0618/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master 06-18)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 262, + "data_size": 15270275447, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.107, 0.042, 0.011], + [0.424, 0.013, 0.013], + [0.92, 0.014, 0.013], + [1.011, 0.074, 0.065], + [1.832, 0.097, 0.103], + [0.142, 0.01, 0.01], + [0.126, 0.026, 0.047], + [1.584, 0.245, 0.242], + [1.922, 0.253, 0.255], + [1.233, 0.134, 0.127], + [1.416, 0.098, 0.085], + [1.865, 0.096, 0.096], + [2.69, 0.124, 0.124], + [2.073, 0.082, 0.079], + [1.005, 0.074, 0.076], + [2.765, 0.147, 0.146], + [2.696, 0.149, 0.123], + [4.064, 0.264, 0.271], + [0.724, 0.003, 0.003], + [9.548, 0.049, 0.045], + [11.093, 0.037, 0.033], + [13.913, 0.088, 0.08], + [5.438, 0.079, 0.08], + [1.992, 0.064, 0.093], + [1.746, 0.037, 0.068], + [2.022, 0.727, 0.045], + [1.191, 0.04, 0.063], + [8.504, 0.841, 0.838], + [0.402, 0.054, 0.046], + [1.589, 0.07, 0.063], + [4.123, 0.087, 0.072], + [3.86, 0.377, 0.348], + [9.99, 0.344, 0.346], + [9.808, 0.337, 0.332], + [0.751, 0.056, 0.051], + [0.804, 0.096, 0.088], + [0.433, 0.069, 0.04], + [0.717, 0.045, 0.027], + [1.17, 0.14, 0.173], + [0.451, 0.034, 0.017], + [0.361, 0.03, 0.013], + [0.257, 0.024, 0.009] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-m0618/start b/clickhouse-i114640-m0618/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-m0618/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-m0618/stop b/clickhouse-i114640-m0618/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-m0618/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-m0618/template.json b/clickhouse-i114640-m0618/template.json new file mode 100644 index 0000000000..77929ea8df --- /dev/null +++ b/clickhouse-i114640-m0618/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master 06-18)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-m0622/benchmark.sh b/clickhouse-i114640-m0622/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-m0622/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-m0622/check b/clickhouse-i114640-m0622/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-m0622/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-m0622/create.sql b/clickhouse-i114640-m0622/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-m0622/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-m0622/data-size b/clickhouse-i114640-m0622/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-m0622/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-m0622/install b/clickhouse-i114640-m0622/install new file mode 100755 index 0000000000..b44fa337cf --- /dev/null +++ b/clickhouse-i114640-m0622/install @@ -0,0 +1,42 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build, round 2 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# master @ 2026-06-22 (just before the 26.6 branch point). +SHA=7ef85344d14af52e564f177db2957d43aebaaa5c + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-m0622/load b/clickhouse-i114640-m0622/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-m0622/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-m0622/queries.sql b/clickhouse-i114640-m0622/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-m0622/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-m0622/query b/clickhouse-i114640-m0622/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-m0622/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-m0622/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-m0622/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..ea2518728e --- /dev/null +++ b/clickhouse-i114640-m0622/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master 06-22)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 242, + "data_size": 15267833461, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.002, 0.001], + [0.146, 0.076, 0.011], + [0.376, 0.015, 0.013], + [0.971, 0.012, 0.011], + [1.011, 0.069, 0.075], + [1.836, 0.104, 0.092], + [0.142, 0.01, 0.01], + [0.139, 0.018, 0.018], + [1.592, 0.256, 0.248], + [1.881, 0.264, 0.287], + [1.215, 0.143, 0.145], + [1.374, 0.109, 0.096], + [1.946, 0.099, 0.123], + [2.755, 0.139, 0.138], + [2.093, 0.086, 0.085], + [0.976, 0.068, 0.074], + [2.847, 0.163, 0.165], + [2.848, 0.149, 0.128], + [4.14, 0.295, 0.265], + [0.647, 0.002, 0.002], + [9.573, 0.06, 0.051], + [11.009, 0.037, 0.034], + [14.032, 0.089, 0.081], + [4.954, 0.075, 0.072], + [1.971, 0.057, 0.059], + [1.827, 0.041, 0.034], + [1.917, 0.599, 0.059], + [1.16, 0.041, 0.042], + [8.204, 0.781, 0.778], + [0.391, 0.046, 0.046], + [1.555, 0.074, 0.084], + [3.83, 0.084, 0.075], + [3.828, 0.36, 0.355], + [9.833, 0.343, 0.375], + [9.739, 0.323, 0.327], + [0.693, 0.06, 0.063], + [0.762, 0.086, 0.081], + [0.403, 0.055, 0.039], + [0.831, 0.023, 0.023], + [1.242, 0.171, 0.15], + [0.417, 0.019, 0.028], + [0.537, 0.03, 0.013], + [0.281, 0.028, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-m0622/start b/clickhouse-i114640-m0622/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-m0622/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-m0622/stop b/clickhouse-i114640-m0622/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-m0622/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-m0622/template.json b/clickhouse-i114640-m0622/template.json new file mode 100644 index 0000000000..34e60bf035 --- /dev/null +++ b/clickhouse-i114640-m0622/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master 06-22)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-m0629/benchmark.sh b/clickhouse-i114640-m0629/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-m0629/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-m0629/check b/clickhouse-i114640-m0629/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-m0629/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-m0629/create.sql b/clickhouse-i114640-m0629/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-m0629/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-m0629/data-size b/clickhouse-i114640-m0629/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-m0629/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-m0629/install b/clickhouse-i114640-m0629/install new file mode 100755 index 0000000000..e3e5cb413f --- /dev/null +++ b/clickhouse-i114640-m0629/install @@ -0,0 +1,44 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build, round 3 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640. +# The universal install script serves DAILY MASTER builds, so the real +# regression window is master 2026-06-23..07-18 (not 26.5..26.6). +# master @ 2026-06-29. +SHA=68024785a7050cd1af475c116d0a59f857887b35 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-m0629/load b/clickhouse-i114640-m0629/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-m0629/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-m0629/queries.sql b/clickhouse-i114640-m0629/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-m0629/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-m0629/query b/clickhouse-i114640-m0629/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-m0629/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-m0629/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-m0629/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..42ec53e5a7 --- /dev/null +++ b/clickhouse-i114640-m0629/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master 06-29)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 248, + "data_size": 15270557591, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.001, 0.001], + [0.157, 0.014, 0.011], + [0.423, 0.014, 0.024], + [0.898, 0.012, 0.012], + [1.025, 0.067, 0.061], + [1.923, 0.101, 0.098], + [0.13, 0.01, 0.01], + [0.164, 0.017, 0.028], + [1.638, 0.246, 0.232], + [1.922, 0.243, 0.239], + [1.261, 0.121, 0.119], + [1.387, 0.11, 0.092], + [1.95, 0.12, 0.119], + [2.803, 0.141, 0.138], + [2.102, 0.088, 0.079], + [1.056, 0.069, 0.057], + [2.727, 0.158, 0.162], + [2.722, 0.139, 0.138], + [4.117, 0.314, 0.275], + [0.669, 0.002, 0.002], + [9.497, 0.052, 0.044], + [10.979, 0.037, 0.034], + [13.894, 0.086, 0.078], + [4.92, 0.078, 0.074], + [1.925, 0.084, 0.047], + [1.797, 0.037, 0.033], + [1.987, 0.65, 0.046], + [1.187, 0.038, 0.037], + [8.199, 0.702, 0.702], + [0.443, 0.063, 0.046], + [1.633, 0.078, 0.066], + [4.096, 0.086, 0.073], + [3.942, 0.462, 0.363], + [9.787, 0.371, 0.343], + [9.87, 0.339, 0.322], + [0.667, 0.062, 0.06], + [0.794, 0.054, 0.05], + [0.442, 0.042, 0.041], + [0.784, 0.038, 0.023], + [1.271, 0.122, 0.101], + [0.406, 0.032, 0.018], + [0.506, 0.03, 0.012], + [0.409, 0.01, 0.009] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-m0629/start b/clickhouse-i114640-m0629/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-m0629/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-m0629/stop b/clickhouse-i114640-m0629/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-m0629/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-m0629/template.json b/clickhouse-i114640-m0629/template.json new file mode 100644 index 0000000000..0e78bc3660 --- /dev/null +++ b/clickhouse-i114640-m0629/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master 06-29)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-m0711/benchmark.sh b/clickhouse-i114640-m0711/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-m0711/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-m0711/check b/clickhouse-i114640-m0711/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-m0711/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-m0711/create.sql b/clickhouse-i114640-m0711/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-m0711/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-m0711/data-size b/clickhouse-i114640-m0711/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-m0711/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-m0711/install b/clickhouse-i114640-m0711/install new file mode 100755 index 0000000000..02f2ff9dec --- /dev/null +++ b/clickhouse-i114640-m0711/install @@ -0,0 +1,44 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build, round 3 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640. +# The universal install script serves DAILY MASTER builds, so the real +# regression window is master 2026-06-23..07-18 (not 26.5..26.6). +# master @ 2026-07-11 (the 26.7 branch point). +SHA=ab8535b3ab0f127a359ba889d9bd26b9456f1897 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-m0711/load b/clickhouse-i114640-m0711/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-m0711/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-m0711/queries.sql b/clickhouse-i114640-m0711/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-m0711/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-m0711/query b/clickhouse-i114640-m0711/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-m0711/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-m0711/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-m0711/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..1a9784effd --- /dev/null +++ b/clickhouse-i114640-m0711/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master 07-11)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 254, + "data_size": 15262292557, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.117, 0.011, 0.011], + [0.379, 0.014, 0.035], + [0.96, 0.013, 0.023], + [1.063, 0.069, 0.064], + [1.947, 0.109, 0.111], + [0.167, 0.01, 0.01], + [0.131, 0.017, 0.031], + [1.578, 0.244, 0.246], + [1.955, 0.246, 0.24], + [1.875, 0.475, 0.391], + [1.598, 0.213, 0.242], + [1.962, 0.104, 0.111], + [2.897, 0.135, 0.134], + [2.068, 0.086, 0.078], + [1.043, 0.067, 0.062], + [2.703, 0.159, 0.155], + [2.8, 0.142, 0.119], + [4.264, 0.264, 0.273], + [0.689, 0.003, 0.002], + [9.484, 0.053, 0.048], + [10.964, 0.021, 0.021], + [13.822, 0.081, 0.062], + [4.742, 0.108, 0.071], + [1.857, 0.172, 0.15], + [1.815, 0.036, 0.031], + [1.919, 0.5, 0.139], + [1.174, 0.026, 0.058], + [8.767, 0.227, 0.223], + [0.393, 0.039, 0.039], + [1.697, 0.068, 0.059], + [3.816, 0.089, 0.085], + [3.925, 0.366, 0.35], + [10.003, 0.343, 0.329], + [9.833, 0.381, 0.366], + [0.712, 0.059, 0.051], + [0.725, 0.071, 0.09], + [0.421, 0.041, 0.045], + [0.736, 0.026, 0.021], + [1.24, 0.155, 0.145], + [0.394, 0.016, 0.016], + [0.388, 0.026, 0.013], + [0.274, 0.023, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-m0711/start b/clickhouse-i114640-m0711/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-m0711/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-m0711/stop b/clickhouse-i114640-m0711/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-m0711/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-m0711/template.json b/clickhouse-i114640-m0711/template.json new file mode 100644 index 0000000000..0c6bbdd0e1 --- /dev/null +++ b/clickhouse-i114640-m0711/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master 07-11)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-m0718/benchmark.sh b/clickhouse-i114640-m0718/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-m0718/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-m0718/check b/clickhouse-i114640-m0718/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-m0718/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-m0718/create.sql b/clickhouse-i114640-m0718/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-m0718/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-m0718/data-size b/clickhouse-i114640-m0718/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-m0718/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-m0718/install b/clickhouse-i114640-m0718/install new file mode 100755 index 0000000000..32523acc5d --- /dev/null +++ b/clickhouse-i114640-m0718/install @@ -0,0 +1,44 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build, round 3 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640. +# The universal install script serves DAILY MASTER builds, so the real +# regression window is master 2026-06-23..07-18 (not 26.5..26.6). +# master @ 2026-07-18 (eve of the first slow daily run). +SHA=9d197f142d0ffdbea12c44349b657814cd2a00e2 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-m0718/load b/clickhouse-i114640-m0718/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-m0718/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-m0718/queries.sql b/clickhouse-i114640-m0718/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-m0718/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-m0718/query b/clickhouse-i114640-m0718/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-m0718/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-m0718/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-m0718/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..57b8de4ee1 --- /dev/null +++ b/clickhouse-i114640-m0718/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master 07-18)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 243, + "data_size": 15267851084, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.002, 0.001], + [0.12, 0.056, 0.01], + [0.417, 0.014, 0.012], + [0.911, 0.011, 0.026], + [1.03, 0.069, 0.068], + [1.857, 0.093, 0.084], + [0.123, 0.01, 0.023], + [0.145, 0.027, 0.051], + [1.566, 0.232, 0.236], + [1.868, 0.233, 0.258], + [1.712, 0.294, 0.399], + [1.541, 0.211, 0.263], + [1.895, 0.1, 0.11], + [2.747, 0.131, 0.124], + [2.082, 0.082, 0.081], + [1.001, 0.067, 0.066], + [2.65, 0.153, 0.155], + [2.774, 0.15, 0.12], + [4.075, 0.29, 0.275], + [0.673, 0.003, 0.002], + [9.52, 0.051, 0.048], + [10.95, 0.024, 0.022], + [13.796, 0.1, 0.063], + [5.025, 0.3, 0.276], + [2.071, 0.175, 0.154], + [1.738, 0.038, 0.038], + [2.024, 0.729, 0.146], + [1.174, 0.03, 0.032], + [8.472, 0.234, 0.227], + [0.408, 0.037, 0.037], + [1.586, 0.081, 0.069], + [3.881, 0.167, 0.075], + [3.849, 0.369, 0.355], + [9.782, 0.353, 0.326], + [9.802, 0.333, 0.345], + [0.749, 0.055, 0.055], + [0.729, 0.066, 0.087], + [0.42, 0.044, 0.043], + [0.722, 0.026, 0.024], + [1.179, 0.162, 0.137], + [0.476, 0.017, 0.015], + [0.358, 0.024, 0.012], + [0.381, 0.027, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-m0718/start b/clickhouse-i114640-m0718/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-m0718/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-m0718/stop b/clickhouse-i114640-m0718/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-m0718/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-m0718/template.json b/clickhouse-i114640-m0718/template.json new file mode 100644 index 0000000000..7236be21f2 --- /dev/null +++ b/clickhouse-i114640-m0718/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master 07-18)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-post/benchmark.sh b/clickhouse-i114640-post/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-post/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-post/check b/clickhouse-i114640-post/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-post/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-post/create.sql b/clickhouse-i114640-post/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-post/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-post/data-size b/clickhouse-i114640-post/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-post/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-post/install b/clickhouse-i114640-post/install new file mode 100755 index 0000000000..d5b878de71 --- /dev/null +++ b/clickhouse-i114640-post/install @@ -0,0 +1,42 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build for the A/B investigation of +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# master merge commit OF the ThreadPool LIFO scheduling change (#100177). +SHA=e78a4dac750cb4e71fb1928c6e3d760817d45e78 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-post/load b/clickhouse-i114640-post/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-post/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-post/queries.sql b/clickhouse-i114640-post/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-post/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-post/query b/clickhouse-i114640-post/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-post/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-post/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-post/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..e859c28f23 --- /dev/null +++ b/clickhouse-i114640-post/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master post-LIFO)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 238, + "data_size": 15272403371, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.002, 0.002], + [0.135, 0.011, 0.012], + [0.405, 0.013, 0.013], + [0.926, 0.014, 0.013], + [1.006, 0.068, 0.088], + [1.887, 0.097, 0.093], + [0.126, 0.01, 0.025], + [0.138, 0.025, 0.03], + [1.55, 0.287, 0.29], + [1.992, 0.244, 0.343], + [1.236, 0.132, 0.13], + [1.334, 0.138, 0.093], + [1.891, 0.115, 0.094], + [2.8, 0.127, 0.13], + [2.082, 0.083, 0.081], + [1.011, 0.068, 0.059], + [2.791, 0.156, 0.154], + [2.649, 0.126, 0.132], + [4.095, 0.295, 0.262], + [0.692, 0.003, 0.003], + [9.56, 0.054, 0.046], + [11.099, 0.038, 0.034], + [13.979, 0.099, 0.082], + [4.782, 0.076, 0.072], + [1.957, 0.078, 0.043], + [1.804, 0.036, 0.027], + [1.866, 0.712, 0.055], + [1.194, 0.045, 0.042], + [8.093, 0.745, 0.733], + [0.458, 0.047, 0.046], + [1.642, 0.072, 0.066], + [3.982, 0.081, 0.081], + [4.086, 0.357, 0.352], + [9.807, 0.332, 0.313], + [9.769, 0.327, 0.316], + [0.711, 0.057, 0.058], + [0.705, 0.088, 0.065], + [0.36, 0.042, 0.065], + [0.769, 0.026, 0.026], + [1.259, 0.144, 0.138], + [0.397, 0.028, 0.018], + [0.332, 0.034, 0.012], + [0.272, 0.021, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-post/start b/clickhouse-i114640-post/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-post/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-post/stop b/clickhouse-i114640-post/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-post/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-post/template.json b/clickhouse-i114640-post/template.json new file mode 100644 index 0000000000..af2c4d0908 --- /dev/null +++ b/clickhouse-i114640-post/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master post-LIFO)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-pre/benchmark.sh b/clickhouse-i114640-pre/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-pre/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-pre/check b/clickhouse-i114640-pre/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-pre/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-pre/create.sql b/clickhouse-i114640-pre/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-pre/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-pre/data-size b/clickhouse-i114640-pre/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-pre/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-pre/install b/clickhouse-i114640-pre/install new file mode 100755 index 0000000000..257a3fef1e --- /dev/null +++ b/clickhouse-i114640-pre/install @@ -0,0 +1,42 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned CI master build for the A/B investigation of +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# master commit right BEFORE the ThreadPool LIFO scheduling change (#100177). +SHA=5719dd022fc457e1ed5f2e7983708e57ed81d6dd + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-pre/load b/clickhouse-i114640-pre/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-pre/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-pre/queries.sql b/clickhouse-i114640-pre/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-pre/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-pre/query b/clickhouse-i114640-pre/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-pre/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-pre/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-pre/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..527d981e12 --- /dev/null +++ b/clickhouse-i114640-pre/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 master pre-LIFO)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 257, + "data_size": 15264899217, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.001, 0.001], + [0.118, 0.011, 0.011], + [0.397, 0.019, 0.013], + [0.928, 0.012, 0.012], + [1.018, 0.08, 0.055], + [1.897, 0.119, 0.14], + [0.112, 0.011, 0.01], + [0.206, 0.019, 0.018], + [1.617, 0.23, 0.233], + [1.875, 0.242, 0.264], + [1.256, 0.18, 0.191], + [1.424, 0.11, 0.099], + [1.936, 0.122, 0.124], + [2.684, 0.186, 0.224], + [1.965, 0.081, 0.095], + [1, 0.083, 0.117], + [2.758, 0.162, 0.183], + [2.654, 0.151, 0.171], + [4.124, 0.277, 0.298], + [0.685, 0.002, 0.002], + [9.493, 0.086, 0.086], + [11.026, 0.243, 0.04], + [13.856, 0.204, 0.177], + [4.697, 0.08, 0.078], + [2.048, 0.097, 0.042], + [1.839, 0.038, 0.032], + [1.998, 0.82, 0.047], + [1.208, 0.051, 0.052], + [8.075, 0.762, 0.832], + [0.516, 0.047, 0.052], + [1.558, 0.084, 0.086], + [3.965, 0.085, 0.083], + [3.952, 0.498, 0.363], + [9.819, 0.349, 0.401], + [9.812, 0.395, 0.417], + [0.706, 0.061, 0.069], + [0.659, 0.087, 0.082], + [0.353, 0.051, 0.049], + [0.619, 0.036, 0.023], + [0.997, 0.131, 0.124], + [0.364, 0.025, 0.018], + [0.316, 0.025, 0.026], + [0.238, 0.035, 0.009] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-pre/start b/clickhouse-i114640-pre/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-pre/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-pre/stop b/clickhouse-i114640-pre/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-pre/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-pre/template.json b/clickhouse-i114640-pre/template.json new file mode 100644 index 0000000000..901cbb2305 --- /dev/null +++ b/clickhouse-i114640-pre/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 master pre-LIFO)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-v2661/benchmark.sh b/clickhouse-i114640-v2661/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-v2661/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-v2661/check b/clickhouse-i114640-v2661/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-v2661/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-v2661/create.sql b/clickhouse-i114640-v2661/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-v2661/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-v2661/data-size b/clickhouse-i114640-v2661/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-v2661/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-v2661/install b/clickhouse-i114640-v2661/install new file mode 100755 index 0000000000..3ac59d2e3e --- /dev/null +++ b/clickhouse-i114640-v2661/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Pinned release build, round 2 of the A/B for +# https://github.com/ClickHouse/ClickHouse/issues/114640: +# official 26.6.1.1193 (first release with the daily-run Q11 slow mode; expected SLOW). +VERSION=26.6.1.1193 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o ch.tgz \ + "https://github.com/ClickHouse/ClickHouse/releases/download/v${VERSION}-stable/clickhouse-common-static-${VERSION}-amd64.tgz" + tar -xzf ch.tgz + sudo "./clickhouse-common-static-${VERSION}/usr/bin/clickhouse" install --noninteractive + rm -rf ch.tgz "clickhouse-common-static-${VERSION}" +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-v2661/load b/clickhouse-i114640-v2661/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-v2661/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-v2661/queries.sql b/clickhouse-i114640-v2661/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-v2661/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-v2661/query b/clickhouse-i114640-v2661/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-v2661/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-v2661/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-v2661/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..34b828ee3b --- /dev/null +++ b/clickhouse-i114640-v2661/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 26.6.1.1193)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 231, + "data_size": 15264807372, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.002], + [0.131, 0.012, 0.012], + [0.372, 0.013, 0.013], + [0.925, 0.025, 0.011], + [1.01, 0.078, 0.064], + [1.939, 0.094, 0.107], + [0.108, 0.01, 0.01], + [0.129, 0.018, 0.018], + [1.675, 0.235, 0.281], + [1.999, 0.243, 0.255], + [1.278, 0.129, 0.139], + [1.311, 0.103, 0.095], + [1.868, 0.098, 0.101], + [2.708, 0.129, 0.127], + [2.032, 0.124, 0.136], + [1.022, 0.071, 0.057], + [2.765, 0.154, 0.15], + [2.702, 0.14, 0.13], + [4.135, 0.274, 0.254], + [0.714, 0.003, 0.003], + [9.436, 0.051, 0.047], + [11.087, 0.041, 0.039], + [13.908, 0.082, 0.076], + [4.92, 0.13, 0.075], + [2.035, 0.072, 0.047], + [1.828, 0.034, 0.031], + [1.965, 0.648, 0.066], + [1.161, 0.046, 0.036], + [8.188, 0.767, 0.757], + [0.407, 0.046, 0.046], + [1.644, 0.073, 0.063], + [4.1, 0.084, 0.066], + [3.865, 0.47, 0.357], + [9.949, 0.357, 0.325], + [10.01, 0.331, 0.331], + [0.691, 0.057, 0.049], + [0.808, 0.084, 0.082], + [0.406, 0.027, 0.029], + [0.816, 0.04, 0.024], + [1.344, 0.179, 0.153], + [0.498, 0.036, 0.015], + [0.441, 0.024, 0.012], + [0.35, 0.023, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-v2661/start b/clickhouse-i114640-v2661/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-v2661/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-v2661/stop b/clickhouse-i114640-v2661/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-v2661/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-v2661/template.json b/clickhouse-i114640-v2661/template.json new file mode 100644 index 0000000000..d2f0f31c54 --- /dev/null +++ b/clickhouse-i114640-v2661/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 26.6.1.1193)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-w1/benchmark.sh b/clickhouse-i114640-w1/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-w1/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-w1/check b/clickhouse-i114640-w1/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-w1/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-w1/create.sql b/clickhouse-i114640-w1/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-w1/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-w1/data-size b/clickhouse-i114640-w1/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-w1/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-w1/install b/clickhouse-i114640-w1/install new file mode 100755 index 0000000000..277adaa8cd --- /dev/null +++ b/clickhouse-i114640-w1/install @@ -0,0 +1,41 @@ +#!/bin/bash +set -e -o pipefail + +# Round 7 (mechanism probes) for https://github.com/ClickHouse/ClickHouse/issues/114640. +# W1: slow m0711 build with bytes-based two-level conversion disabled. +SHA=ab8535b3ab0f127a359ba889d9bd26b9456f1897 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-w1/load b/clickhouse-i114640-w1/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-w1/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-w1/queries.sql b/clickhouse-i114640-w1/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-w1/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-w1/query b/clickhouse-i114640-w1/query new file mode 100755 index 0000000000..d45226c706 --- /dev/null +++ b/clickhouse-i114640-w1/query @@ -0,0 +1,9 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +# Mechanism probe for issue #114640: group_by_two_level_threshold_bytes=0 on the slow build +set -e + +clickhouse-client --time --format=Pretty --group_by_two_level_threshold_bytes=0 diff --git a/clickhouse-i114640-w1/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-w1/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..dcb2bea4b3 --- /dev/null +++ b/clickhouse-i114640-w1/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 W1 m0711 no-2lvl-bytes)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 262, + "data_size": 15264622797, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.002, 0.001], + [0.123, 0.012, 0.011], + [0.417, 0.014, 0.012], + [0.93, 0.012, 0.012], + [0.99, 0.069, 0.075], + [1.875, 0.105, 0.102], + [0.125, 0.011, 0.01], + [0.113, 0.018, 0.017], + [2.856, 0.293, 0.266], + [3.209, 0.242, 0.299], + [1.193, 0.099, 0.093], + [1.348, 0.102, 0.117], + [3.677, 0.113, 0.114], + [4.015, 0.141, 0.126], + [2.957, 0.087, 0.079], + [1.274, 0.071, 0.061], + [2.946, 0.152, 0.154], + [2.781, 0.13, 0.124], + [4.118, 0.253, 0.26], + [0.651, 0.003, 0.002], + [9.395, 0.052, 0.051], + [11.022, 0.021, 0.021], + [13.923, 0.089, 0.062], + [4.03, 0.075, 0.084], + [1.841, 0.231, 0.161], + [1.775, 0.037, 0.028], + [1.861, 0.655, 0.095], + [1.156, 0.036, 0.024], + [10.941, 0.24, 0.216], + [0.392, 0.04, 0.04], + [2.197, 0.076, 0.06], + [4.627, 0.084, 0.071], + [3.948, 0.476, 0.367], + [10.214, 0.338, 0.317], + [10.112, 0.34, 0.33], + [1.069, 0.066, 0.05], + [0.764, 0.088, 0.076], + [0.371, 0.036, 0.038], + [0.76, 0.027, 0.028], + [1.336, 0.151, 0.207], + [0.481, 0.02, 0.017], + [0.353, 0.027, 0.03], + [0.327, 0.029, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-w1/start b/clickhouse-i114640-w1/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-w1/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-w1/stop b/clickhouse-i114640-w1/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-w1/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-w1/template.json b/clickhouse-i114640-w1/template.json new file mode 100644 index 0000000000..773c0ccbfc --- /dev/null +++ b/clickhouse-i114640-w1/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 W1 m0711 no-2lvl-bytes)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-w2/benchmark.sh b/clickhouse-i114640-w2/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-w2/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-w2/check b/clickhouse-i114640-w2/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-w2/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-w2/create.sql b/clickhouse-i114640-w2/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-w2/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-w2/data-size b/clickhouse-i114640-w2/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-w2/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-w2/install b/clickhouse-i114640-w2/install new file mode 100755 index 0000000000..7a020c8dbf --- /dev/null +++ b/clickhouse-i114640-w2/install @@ -0,0 +1,41 @@ +#!/bin/bash +set -e -o pipefail + +# Round 7 (mechanism probes) for https://github.com/ClickHouse/ClickHouse/issues/114640. +# W2: slow m0711 build with external GROUP BY spill disabled. +SHA=ab8535b3ab0f127a359ba889d9bd26b9456f1897 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-w2/load b/clickhouse-i114640-w2/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-w2/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-w2/queries.sql b/clickhouse-i114640-w2/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-w2/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-w2/query b/clickhouse-i114640-w2/query new file mode 100755 index 0000000000..97dadfd254 --- /dev/null +++ b/clickhouse-i114640-w2/query @@ -0,0 +1,9 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +# Mechanism probe for issue #114640: max_bytes_ratio_before_external_group_by=0 on the slow build +set -e + +clickhouse-client --time --format=Pretty --max_bytes_ratio_before_external_group_by=0 diff --git a/clickhouse-i114640-w2/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-w2/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..7e5b351327 --- /dev/null +++ b/clickhouse-i114640-w2/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 W2 m0711 no-spill)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 269, + "data_size": 15264467214, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.012, 0.001], + [0.16, 0.01, 0.011], + [0.43, 0.014, 0.012], + [0.94, 0.014, 0.011], + [0.974, 0.075, 0.082], + [1.824, 0.094, 0.096], + [0.116, 0.01, 0.01], + [0.108, 0.017, 0.017], + [1.584, 0.265, 0.23], + [1.862, 0.226, 0.236], + [1.715, 0.473, 0.609], + [1.529, 0.19, 0.281], + [1.895, 0.098, 0.088], + [2.816, 0.128, 0.169], + [2.194, 0.083, 0.077], + [0.962, 0.066, 0.059], + [3.085, 0.163, 0.146], + [2.727, 0.135, 0.124], + [4.227, 0.283, 0.258], + [0.676, 0.003, 0.003], + [9.582, 0.063, 0.052], + [11.09, 0.023, 0.02], + [13.816, 0.109, 0.068], + [5.156, 0.074, 0.072], + [2.125, 0.201, 0.158], + [1.809, 0.035, 0.032], + [2.008, 0.701, 0.148], + [1.125, 0.027, 0.033], + [8.754, 0.23, 0.225], + [0.412, 0.039, 0.039], + [1.574, 0.07, 0.068], + [3.992, 0.094, 0.073], + [3.828, 0.353, 0.354], + [10.091, 0.337, 0.32], + [9.976, 0.36, 0.317], + [0.703, 0.057, 0.05], + [0.676, 0.084, 0.052], + [0.288, 0.024, 0.024], + [0.572, 0.026, 0.015], + [0.927, 0.051, 0.045], + [0.305, 0.014, 0.011], + [0.3, 0.024, 0.009], + [0.244, 0.008, 0.007] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-w2/start b/clickhouse-i114640-w2/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-w2/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-w2/stop b/clickhouse-i114640-w2/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-w2/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-w2/template.json b/clickhouse-i114640-w2/template.json new file mode 100644 index 0000000000..c87760f763 --- /dev/null +++ b/clickhouse-i114640-w2/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 W2 m0711 no-spill)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-w3/benchmark.sh b/clickhouse-i114640-w3/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-w3/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-w3/check b/clickhouse-i114640-w3/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-w3/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-w3/create.sql b/clickhouse-i114640-w3/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-w3/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-w3/data-size b/clickhouse-i114640-w3/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-w3/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-w3/install b/clickhouse-i114640-w3/install new file mode 100755 index 0000000000..90f57097eb --- /dev/null +++ b/clickhouse-i114640-w3/install @@ -0,0 +1,41 @@ +#!/bin/bash +set -e -o pipefail + +# Round 7 (mechanism probes) for https://github.com/ClickHouse/ClickHouse/issues/114640. +# W3: fast pre-regression build with two-level conversion FORCED (threshold=1 key). +SHA=ddbfc52e731114d53d83663458ce11d7fe2ad410 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-w3/load b/clickhouse-i114640-w3/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-w3/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-w3/queries.sql b/clickhouse-i114640-w3/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-w3/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-w3/query b/clickhouse-i114640-w3/query new file mode 100755 index 0000000000..a19332391a --- /dev/null +++ b/clickhouse-i114640-w3/query @@ -0,0 +1,9 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +# Mechanism probe for issue #114640: group_by_two_level_threshold=1 on the fast build +set -e + +clickhouse-client --time --format=Pretty --group_by_two_level_threshold=1 diff --git a/clickhouse-i114640-w3/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-w3/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..d1d8ee9472 --- /dev/null +++ b/clickhouse-i114640-w3/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 W3 y1 force-2lvl)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 255, + "data_size": 15264737608, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.127, 0.01, 0.011], + [0.409, 0.014, 0.013], + [0.917, 0.013, 0.012], + [1.001, 0.082, 0.065], + [1.943, 0.102, 0.095], + [0.18, 0.01, 0.01], + [0.125, 0.017, 0.018], + [1.611, 0.245, 0.229], + [1.925, 0.25, 0.239], + [1.296, 0.139, 0.132], + [1.375, 0.103, 0.095], + [1.914, 0.101, 0.105], + [2.728, 0.13, 0.134], + [1.971, 0.082, 0.078], + [1.016, 0.068, 0.062], + [2.723, 0.158, 0.154], + [2.661, 0.144, 0.137], + [4.072, 0.285, 0.262], + [0.636, 0.003, 0.003], + [9.607, 0.052, 0.048], + [11.069, 0.038, 0.032], + [13.911, 0.087, 0.079], + [5.284, 0.079, 0.081], + [1.906, 0.045, 0.071], + [1.735, 0.033, 0.069], + [1.883, 0.647, 0.035], + [1.218, 0.043, 0.045], + [8.053, 0.653, 0.636], + [0.428, 0.05, 0.047], + [1.613, 0.079, 0.076], + [3.96, 0.09, 0.076], + [3.889, 0.364, 0.362], + [9.912, 0.352, 0.354], + [10.25, 0.378, 0.374], + [0.699, 0.056, 0.073], + [0.802, 0.081, 0.081], + [0.371, 0.041, 0.043], + [0.759, 0.083, 0.057], + [1.216, 0.133, 0.147], + [0.345, 0.026, 0.016], + [0.376, 0.039, 0.024], + [0.263, 0.029, 0.025] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-w3/start b/clickhouse-i114640-w3/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-w3/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-w3/stop b/clickhouse-i114640-w3/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-w3/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-w3/template.json b/clickhouse-i114640-w3/template.json new file mode 100644 index 0000000000..f0e93b4725 --- /dev/null +++ b/clickhouse-i114640-w3/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 W3 y1 force-2lvl)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-x1/benchmark.sh b/clickhouse-i114640-x1/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-x1/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-x1/check b/clickhouse-i114640-x1/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-x1/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-x1/create.sql b/clickhouse-i114640-x1/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-x1/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-x1/data-size b/clickhouse-i114640-x1/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-x1/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-x1/install b/clickhouse-i114640-x1/install new file mode 100755 index 0000000000..e90698d7d0 --- /dev/null +++ b/clickhouse-i114640-x1/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Round 4 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# straddle the uniqExact two-level copy-on-write cluster inside the guilty +# master window 06-29..07-11 (Q10/Q11/Q24/Q26 flipped there in round 3). +# X1: master @ c3f8ef333f5 (2026-07-02, merged just BEFORE #108928). +SHA=c3f8ef333f54a4ee33375f4c7f9e9abd112c57e0 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-x1/load b/clickhouse-i114640-x1/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-x1/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-x1/queries.sql b/clickhouse-i114640-x1/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-x1/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-x1/query b/clickhouse-i114640-x1/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-x1/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-x1/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-x1/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..ddcb69dbc6 --- /dev/null +++ b/clickhouse-i114640-x1/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 X1 pre-108928)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 252, + "data_size": 15261497396, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.125, 0.022, 0.01], + [0.405, 0.014, 0.012], + [0.952, 0.013, 0.012], + [1.046, 0.067, 0.08], + [1.899, 0.096, 0.105], + [0.146, 0.01, 0.01], + [0.123, 0.027, 0.024], + [1.639, 0.23, 0.242], + [1.907, 0.237, 0.256], + [1.979, 0.582, 0.269], + [1.552, 0.171, 0.259], + [1.864, 0.103, 0.095], + [2.743, 0.132, 0.121], + [2.033, 0.085, 0.082], + [1.025, 0.065, 0.057], + [2.766, 0.162, 0.156], + [2.733, 0.131, 0.127], + [4.171, 0.273, 0.27], + [0.678, 0.003, 0.003], + [9.557, 0.048, 0.045], + [11.087, 0.022, 0.021], + [13.83, 0.091, 0.061], + [5.101, 0.077, 0.074], + [1.966, 0.145, 0.143], + [1.814, 0.035, 0.029], + [1.98, 0.647, 0.115], + [1.151, 0.026, 0.026], + [8.169, 0.68, 0.66], + [0.397, 0.076, 0.047], + [1.61, 0.067, 0.061], + [3.878, 0.084, 0.082], + [3.826, 0.362, 0.354], + [9.952, 0.335, 0.314], + [9.831, 0.343, 0.364], + [0.711, 0.053, 0.047], + [0.686, 0.08, 0.075], + [0.435, 0.04, 0.038], + [0.752, 0.024, 0.022], + [1.297, 0.142, 0.116], + [0.344, 0.017, 0.017], + [0.333, 0.025, 0.011], + [0.322, 0.022, 0.01] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-x1/start b/clickhouse-i114640-x1/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-x1/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-x1/stop b/clickhouse-i114640-x1/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-x1/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-x1/template.json b/clickhouse-i114640-x1/template.json new file mode 100644 index 0000000000..92da0b2395 --- /dev/null +++ b/clickhouse-i114640-x1/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 X1 pre-108928)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-x2/benchmark.sh b/clickhouse-i114640-x2/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-x2/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-x2/check b/clickhouse-i114640-x2/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-x2/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-x2/create.sql b/clickhouse-i114640-x2/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-x2/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-x2/data-size b/clickhouse-i114640-x2/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-x2/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-x2/install b/clickhouse-i114640-x2/install new file mode 100755 index 0000000000..9f11d52dca --- /dev/null +++ b/clickhouse-i114640-x2/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Round 4 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# straddle the uniqExact two-level copy-on-write cluster inside the guilty +# master window 06-29..07-11 (Q10/Q11/Q24/Q26 flipped there in round 3). +# X2: master @ 597ffae623d (2026-07-05, has #108928, lacks #109389). +SHA=597ffae623d4683ab2df45fa6efe2f2028bccf2e + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-x2/load b/clickhouse-i114640-x2/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-x2/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-x2/queries.sql b/clickhouse-i114640-x2/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-x2/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-x2/query b/clickhouse-i114640-x2/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-x2/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-x2/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-x2/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..9d35a7e54c --- /dev/null +++ b/clickhouse-i114640-x2/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 X2 with-108928)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 249, + "data_size": 15266828950, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.113, 0.011, 0.012], + [0.36, 0.013, 0.012], + [0.982, 0.013, 0.012], + [0.993, 0.071, 0.064], + [1.936, 0.091, 0.095], + [0.08, 0.01, 0.011], + [0.119, 0.047, 0.017], + [1.56, 0.255, 0.249], + [1.872, 0.259, 0.264], + [1.688, 0.464, 0.534], + [1.473, 0.221, 0.216], + [1.947, 0.099, 0.096], + [2.765, 0.136, 0.117], + [2.165, 0.122, 0.09], + [1.008, 0.077, 0.057], + [2.838, 0.174, 0.153], + [2.771, 0.159, 0.117], + [4.334, 0.263, 0.29], + [0.656, 0.002, 0.002], + [9.583, 0.056, 0.048], + [11.053, 0.022, 0.021], + [13.705, 0.073, 0.062], + [4.221, 0.074, 0.073], + [2.081, 0.177, 0.15], + [1.828, 0.032, 0.034], + [2.04, 0.792, 0.13], + [1.143, 0.028, 0.052], + [8.48, 0.216, 0.209], + [0.375, 0.038, 0.038], + [1.628, 0.072, 0.074], + [3.987, 0.102, 0.071], + [3.922, 0.354, 0.36], + [9.868, 0.348, 0.32], + [9.959, 0.347, 0.348], + [0.682, 0.055, 0.057], + [0.517, 0.069, 0.036], + [0.342, 0.025, 0.027], + [0.49, 0.068, 0.015], + [0.905, 0.057, 0.055], + [0.327, 0.014, 0.014], + [0.34, 0.01, 0.01], + [0.223, 0.008, 0.008] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-x2/start b/clickhouse-i114640-x2/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-x2/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-x2/stop b/clickhouse-i114640-x2/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-x2/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-x2/template.json b/clickhouse-i114640-x2/template.json new file mode 100644 index 0000000000..c8dddafd89 --- /dev/null +++ b/clickhouse-i114640-x2/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 X2 with-108928)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-x3/benchmark.sh b/clickhouse-i114640-x3/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-x3/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-x3/check b/clickhouse-i114640-x3/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-x3/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-x3/create.sql b/clickhouse-i114640-x3/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-x3/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-x3/data-size b/clickhouse-i114640-x3/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-x3/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-x3/install b/clickhouse-i114640-x3/install new file mode 100755 index 0000000000..ce6f8b8dd3 --- /dev/null +++ b/clickhouse-i114640-x3/install @@ -0,0 +1,43 @@ +#!/bin/bash +set -e -o pipefail + +# Round 4 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# straddle the uniqExact two-level copy-on-write cluster inside the guilty +# master window 06-29..07-11 (Q10/Q11/Q24/Q26 flipped there in round 3). +# X3: master @ 6a27522419b (2026-07-07, has #108928 AND #109389). +SHA=6a27522419b52820f04900d9fa5ff4b006acd433 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-x3/load b/clickhouse-i114640-x3/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-x3/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-x3/queries.sql b/clickhouse-i114640-x3/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-x3/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-x3/query b/clickhouse-i114640-x3/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-x3/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-x3/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-x3/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..b95cf774a0 --- /dev/null +++ b/clickhouse-i114640-x3/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 X3 with-109389)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 254, + "data_size": 15273637911, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.002, 0.001], + [0.135, 0.012, 0.011], + [0.389, 0.014, 0.014], + [0.887, 0.025, 0.012], + [1.016, 0.073, 0.079], + [1.95, 0.1, 0.097], + [0.138, 0.025, 0.01], + [0.124, 0.018, 0.027], + [1.594, 0.252, 0.248], + [1.969, 0.276, 0.273], + [1.666, 0.501, 0.295], + [1.571, 0.249, 0.247], + [1.828, 0.099, 0.108], + [2.634, 0.136, 0.129], + [2.128, 0.083, 0.08], + [1.029, 0.066, 0.083], + [2.706, 0.154, 0.153], + [2.675, 0.146, 0.127], + [4.146, 0.27, 0.262], + [0.718, 0.003, 0.002], + [9.522, 0.057, 0.047], + [11.004, 0.024, 0.021], + [13.937, 0.077, 0.064], + [5.34, 0.076, 0.074], + [2.01, 0.211, 0.159], + [1.823, 0.085, 0.027], + [2.027, 0.928, 0.168], + [1.176, 0.037, 0.024], + [8.708, 0.241, 0.238], + [0.409, 0.038, 0.038], + [1.623, 0.068, 0.067], + [3.857, 0.084, 0.072], + [3.971, 0.385, 0.351], + [9.788, 0.352, 0.322], + [9.849, 0.361, 0.349], + [0.704, 0.058, 0.068], + [0.633, 0.108, 0.087], + [0.439, 0.041, 0.042], + [0.729, 0.025, 0.025], + [1.088, 0.139, 0.135], + [0.344, 0.032, 0.019], + [0.306, 0.04, 0.012], + [0.235, 0.025, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-x3/start b/clickhouse-i114640-x3/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-x3/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-x3/stop b/clickhouse-i114640-x3/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-x3/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-x3/template.json b/clickhouse-i114640-x3/template.json new file mode 100644 index 0000000000..b990016cac --- /dev/null +++ b/clickhouse-i114640-x3/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 X3 with-109389)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-y1/benchmark.sh b/clickhouse-i114640-y1/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-y1/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-y1/check b/clickhouse-i114640-y1/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-y1/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-y1/create.sql b/clickhouse-i114640-y1/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-y1/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-y1/data-size b/clickhouse-i114640-y1/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-y1/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-y1/install b/clickhouse-i114640-y1/install new file mode 100755 index 0000000000..22d318fdad --- /dev/null +++ b/clickhouse-i114640-y1/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 5 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# the guilty window is master 06-29..07-02 (round 4: X1 already slow, so both +# uniqExact PRs, read_in_order and LIMIT WITH TIES are exonerated). The window +# contains the qcc-for-topn merge (#104478) and two more QCC changes, and the +# affected queries are exactly the ones whose hot runs benefit from the query +# condition cache. Y1: master @ ddbfc52e731 (06-30 23:42, just BEFORE qcc-for-topn). +SHA=ddbfc52e731114d53d83663458ce11d7fe2ad410 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-y1/load b/clickhouse-i114640-y1/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-y1/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-y1/queries.sql b/clickhouse-i114640-y1/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-y1/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-y1/query b/clickhouse-i114640-y1/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-y1/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-y1/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-y1/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..293b327926 --- /dev/null +++ b/clickhouse-i114640-y1/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Y1 pre-qcc-topn)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 270, + "data_size": 15261574166, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.121, 0.011, 0.012], + [0.446, 0.013, 0.013], + [0.915, 0.013, 0.025], + [1.012, 0.07, 0.083], + [1.873, 0.094, 0.086], + [0.1, 0.01, 0.011], + [0.11, 0.017, 0.033], + [1.575, 0.291, 0.239], + [1.942, 0.242, 0.217], + [1.298, 0.124, 0.129], + [1.289, 0.112, 0.078], + [1.998, 0.099, 0.107], + [2.748, 0.128, 0.129], + [2.107, 0.084, 0.078], + [0.996, 0.068, 0.054], + [2.721, 0.168, 0.149], + [2.702, 0.141, 0.118], + [4.217, 0.282, 0.265], + [0.714, 0.002, 0.002], + [9.587, 0.055, 0.05], + [11.099, 0.04, 0.034], + [13.843, 0.112, 0.078], + [5.566, 0.079, 0.08], + [1.873, 0.107, 0.087], + [1.766, 0.04, 0.037], + [1.999, 0.586, 0.059], + [1.155, 0.044, 0.04], + [8.087, 0.718, 0.707], + [0.47, 0.092, 0.047], + [1.566, 0.077, 0.064], + [4.141, 0.083, 0.068], + [3.848, 0.369, 0.357], + [10.197, 0.328, 0.305], + [9.86, 0.331, 0.34], + [0.684, 0.056, 0.047], + [0.751, 0.076, 0.072], + [0.382, 0.042, 0.034], + [0.876, 0.028, 0.025], + [1.366, 0.161, 0.203], + [0.424, 0.017, 0.018], + [0.356, 0.026, 0.014], + [0.222, 0.02, 0.008] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-y1/start b/clickhouse-i114640-y1/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-y1/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-y1/stop b/clickhouse-i114640-y1/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-y1/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-y1/template.json b/clickhouse-i114640-y1/template.json new file mode 100644 index 0000000000..487c59ea5d --- /dev/null +++ b/clickhouse-i114640-y1/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Y1 pre-qcc-topn)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-y2/benchmark.sh b/clickhouse-i114640-y2/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-y2/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-y2/check b/clickhouse-i114640-y2/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-y2/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-y2/create.sql b/clickhouse-i114640-y2/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-y2/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-y2/data-size b/clickhouse-i114640-y2/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-y2/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-y2/install b/clickhouse-i114640-y2/install new file mode 100755 index 0000000000..28e0e33773 --- /dev/null +++ b/clickhouse-i114640-y2/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 5 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# the guilty window is master 06-29..07-02 (round 4: X1 already slow, so both +# uniqExact PRs, read_in_order and LIMIT WITH TIES are exonerated). The window +# contains the qcc-for-topn merge (#104478) and two more QCC changes, and the +# affected queries are exactly the ones whose hot runs benefit from the query +# condition cache. Y2: master @ 61b644e0380 (07-01 02:50, just AFTER qcc-for-topn #104478). +SHA=61b644e0380dce867eb6460872e685e20c6bf506 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-y2/load b/clickhouse-i114640-y2/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-y2/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-y2/queries.sql b/clickhouse-i114640-y2/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-y2/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-y2/query b/clickhouse-i114640-y2/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-y2/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-y2/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-y2/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..214f5a4c8e --- /dev/null +++ b/clickhouse-i114640-y2/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Y2 post-qcc-topn)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 257, + "data_size": 15267886141, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.111, 0.011, 0.011], + [0.435, 0.014, 0.013], + [0.924, 0.012, 0.012], + [1.065, 0.069, 0.075], + [1.915, 0.099, 0.101], + [0.128, 0.011, 0.011], + [0.122, 0.016, 0.027], + [1.594, 0.226, 0.228], + [2.038, 0.236, 0.282], + [1.286, 0.137, 0.135], + [1.36, 0.107, 0.096], + [1.871, 0.111, 0.11], + [2.762, 0.13, 0.13], + [2.013, 0.083, 0.082], + [1.05, 0.063, 0.076], + [2.676, 0.155, 0.155], + [2.736, 0.13, 0.132], + [4.137, 0.278, 0.28], + [0.73, 0.003, 0.002], + [9.563, 0.051, 0.048], + [11.09, 0.038, 0.035], + [13.939, 0.086, 0.079], + [5.025, 0.078, 0.075], + [1.961, 0.183, 0.126], + [1.761, 0.035, 0.061], + [1.906, 0.783, 0.164], + [1.204, 0.084, 0.042], + [8.045, 0.676, 0.674], + [0.473, 0.048, 0.047], + [1.602, 0.07, 0.073], + [3.95, 0.083, 0.072], + [3.862, 0.471, 0.354], + [9.876, 0.33, 0.319], + [10.018, 0.388, 0.339], + [0.716, 0.07, 0.056], + [0.756, 0.08, 0.061], + [0.396, 0.049, 0.036], + [0.845, 0.032, 0.028], + [1.374, 0.156, 0.185], + [0.425, 0.021, 0.017], + [0.377, 0.031, 0.012], + [0.353, 0.028, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-y2/start b/clickhouse-i114640-y2/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-y2/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-y2/stop b/clickhouse-i114640-y2/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-y2/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-y2/template.json b/clickhouse-i114640-y2/template.json new file mode 100644 index 0000000000..3a3d21b7a0 --- /dev/null +++ b/clickhouse-i114640-y2/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Y2 post-qcc-topn)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-y3/benchmark.sh b/clickhouse-i114640-y3/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-y3/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-y3/check b/clickhouse-i114640-y3/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-y3/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-y3/create.sql b/clickhouse-i114640-y3/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-y3/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-y3/data-size b/clickhouse-i114640-y3/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-y3/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-y3/install b/clickhouse-i114640-y3/install new file mode 100755 index 0000000000..e69d931247 --- /dev/null +++ b/clickhouse-i114640-y3/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 5 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# the guilty window is master 06-29..07-02 (round 4: X1 already slow, so both +# uniqExact PRs, read_in_order and LIMIT WITH TIES are exonerated). The window +# contains the qcc-for-topn merge (#104478) and two more QCC changes, and the +# affected queries are exactly the ones whose hot runs benefit from the query +# condition cache. Y3: the known-SLOW master 07-11 build, with use_query_condition_cache=0. +SHA=ab8535b3ab0f127a359ba889d9bd26b9456f1897 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-y3/load b/clickhouse-i114640-y3/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-y3/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-y3/queries.sql b/clickhouse-i114640-y3/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-y3/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-y3/query b/clickhouse-i114640-y3/query new file mode 100755 index 0000000000..d828192cc3 --- /dev/null +++ b/clickhouse-i114640-y3/query @@ -0,0 +1,9 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +# Mechanism probe for issue #114640: query condition cache disabled. +set -e + +clickhouse-client --time --format=Pretty --use_query_condition_cache=0 diff --git a/clickhouse-i114640-y3/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-y3/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..40d0fc6e74 --- /dev/null +++ b/clickhouse-i114640-y3/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Y3 m0711 qcc-off)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 241, + "data_size": 15267840006, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.002, 0.001], + [0.134, 0.011, 0.021], + [0.384, 0.014, 0.012], + [0.903, 0.013, 0.011], + [1.172, 0.06, 0.061], + [1.909, 0.104, 0.09], + [0.122, 0.011, 0.01], + [0.13, 0.017, 0.028], + [1.591, 0.218, 0.251], + [1.896, 0.237, 0.234], + [1.57, 0.35, 0.344], + [1.52, 0.219, 0.218], + [1.859, 0.126, 0.106], + [2.676, 0.14, 0.138], + [2.105, 0.085, 0.079], + [1.028, 0.068, 0.069], + [2.728, 0.151, 0.163], + [2.716, 0.143, 0.125], + [4.17, 0.264, 0.276], + [0.7, 0.009, 0.008], + [9.542, 0.077, 0.069], + [11.027, 0.079, 0.073], + [13.772, 0.105, 0.092], + [5.129, 0.073, 0.069], + [1.942, 0.077, 0.067], + [1.717, 0.029, 0.029], + [2.067, 0.817, 0.063], + [1.186, 0.026, 0.023], + [8.49, 0.215, 0.218], + [0.572, 0.042, 0.039], + [1.526, 0.072, 0.075], + [3.837, 0.081, 0.073], + [4.028, 0.482, 0.36], + [9.883, 0.366, 0.331], + [9.869, 0.336, 0.328], + [0.736, 0.055, 0.052], + [0.826, 0.07, 0.079], + [0.478, 0.047, 0.03], + [0.875, 0.034, 0.044], + [1.272, 0.148, 0.13], + [0.504, 0.018, 0.014], + [0.376, 0.012, 0.012], + [0.278, 0.01, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-y3/start b/clickhouse-i114640-y3/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-y3/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-y3/stop b/clickhouse-i114640-y3/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-y3/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-y3/template.json b/clickhouse-i114640-y3/template.json new file mode 100644 index 0000000000..de579a4be3 --- /dev/null +++ b/clickhouse-i114640-y3/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Y3 m0711 qcc-off)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-y4/benchmark.sh b/clickhouse-i114640-y4/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-y4/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-y4/check b/clickhouse-i114640-y4/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-y4/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-y4/create.sql b/clickhouse-i114640-y4/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-y4/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-y4/data-size b/clickhouse-i114640-y4/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-y4/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-y4/install b/clickhouse-i114640-y4/install new file mode 100755 index 0000000000..19190af1ee --- /dev/null +++ b/clickhouse-i114640-y4/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 5 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# the guilty window is master 06-29..07-02 (round 4: X1 already slow, so both +# uniqExact PRs, read_in_order and LIMIT WITH TIES are exonerated). The window +# contains the qcc-for-topn merge (#104478) and two more QCC changes, and the +# affected queries are exactly the ones whose hot runs benefit from the query +# condition cache. Y4: the known-FAST pre-qcc-topn build, with use_query_condition_cache=0. If this is slow, the fast mode depends on the QCC. +SHA=ddbfc52e731114d53d83663458ce11d7fe2ad410 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-y4/load b/clickhouse-i114640-y4/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-y4/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-y4/queries.sql b/clickhouse-i114640-y4/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-y4/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-y4/query b/clickhouse-i114640-y4/query new file mode 100755 index 0000000000..d828192cc3 --- /dev/null +++ b/clickhouse-i114640-y4/query @@ -0,0 +1,9 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +# Mechanism probe for issue #114640: query condition cache disabled. +set -e + +clickhouse-client --time --format=Pretty --use_query_condition_cache=0 diff --git a/clickhouse-i114640-y4/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-y4/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..e5324ef857 --- /dev/null +++ b/clickhouse-i114640-y4/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Y4 Y1 qcc-off)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 286, + "data_size": 15263747664, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.034, 0.001], + [0.121, 0.013, 0.012], + [0.383, 0.025, 0.021], + [0.939, 0.025, 0.013], + [1.009, 0.067, 0.066], + [1.903, 0.122, 0.102], + [0.098, 0.01, 0.01], + [0.129, 0.029, 0.018], + [1.57, 0.239, 0.226], + [1.909, 0.243, 0.227], + [1.283, 0.137, 0.144], + [1.33, 0.098, 0.092], + [1.837, 0.098, 0.106], + [2.668, 0.132, 0.127], + [2.031, 0.087, 0.087], + [1.011, 0.066, 0.066], + [2.601, 0.162, 0.155], + [2.619, 0.148, 0.129], + [4.123, 0.292, 0.262], + [0.667, 0.009, 0.008], + [9.621, 0.073, 0.078], + [11.089, 0.111, 0.097], + [13.97, 0.151, 0.137], + [5.063, 0.152, 0.076], + [1.969, 0.071, 0.085], + [1.776, 0.034, 0.036], + [1.971, 0.606, 0.048], + [1.18, 0.038, 0.045], + [8.063, 0.69, 0.673], + [0.389, 0.066, 0.047], + [1.532, 0.075, 0.067], + [4.039, 0.083, 0.074], + [3.836, 0.359, 0.348], + [9.889, 0.326, 0.331], + [10.166, 0.345, 0.342], + [0.699, 0.055, 0.055], + [0.734, 0.079, 0.078], + [0.416, 0.066, 0.027], + [0.717, 0.028, 0.025], + [1.123, 0.136, 0.121], + [0.348, 0.035, 0.019], + [0.368, 0.03, 0.012], + [0.266, 0.011, 0.021] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-y4/start b/clickhouse-i114640-y4/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-y4/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-y4/stop b/clickhouse-i114640-y4/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-y4/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-y4/template.json b/clickhouse-i114640-y4/template.json new file mode 100644 index 0000000000..65de9be01f --- /dev/null +++ b/clickhouse-i114640-y4/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Y4 Y1 qcc-off)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-z1/benchmark.sh b/clickhouse-i114640-z1/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-z1/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-z1/check b/clickhouse-i114640-z1/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-z1/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-z1/create.sql b/clickhouse-i114640-z1/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-z1/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-z1/data-size b/clickhouse-i114640-z1/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-z1/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-z1/install b/clickhouse-i114640-z1/install new file mode 100755 index 0000000000..da85a5e053 --- /dev/null +++ b/clickhouse-i114640-z1/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 6 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# surgical straddle of #107490 (Aggregator memory usage accounting, merged +# 8fa9200c0a8 on 07-01 07:35). Round 5 isolated the Q10/Q11 flip to +# 07-01 02:50 .. 07-02 10:05 and proved it is NOT query-condition-cache +# related; #107490 changes the accounting that feeds the aggregation +# two-level-conversion bytes threshold. Z1: master @ c79b0d9227e (07-01 07:31, 4 minutes BEFORE #107490). +SHA=c79b0d9227e23490a4779c274e946b2e4f991b50 + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-z1/load b/clickhouse-i114640-z1/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-z1/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-z1/queries.sql b/clickhouse-i114640-z1/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-z1/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-z1/query b/clickhouse-i114640-z1/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-z1/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-z1/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-z1/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..1660267537 --- /dev/null +++ b/clickhouse-i114640-z1/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Z1 pre-107490)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 247, + "data_size": 15264573484, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.001, 0.001, 0.001], + [0.149, 0.011, 0.033], + [0.408, 0.013, 0.012], + [0.914, 0.022, 0.02], + [1.008, 0.075, 0.079], + [1.811, 0.094, 0.125], + [0.128, 0.01, 0.011], + [0.154, 0.017, 0.017], + [1.585, 0.224, 0.23], + [1.889, 0.242, 0.221], + [1.222, 0.133, 0.141], + [1.439, 0.097, 0.092], + [1.853, 0.101, 0.155], + [2.76, 0.133, 0.134], + [2.002, 0.085, 0.113], + [0.974, 0.078, 0.075], + [2.704, 0.155, 0.155], + [2.777, 0.131, 0.121], + [4.102, 0.289, 0.272], + [0.685, 0.003, 0.003], + [9.479, 0.061, 0.053], + [10.991, 0.037, 0.035], + [13.844, 0.09, 0.087], + [4.395, 0.075, 0.075], + [1.979, 0.196, 0.14], + [1.816, 0.028, 0.029], + [1.944, 0.835, 0.192], + [1.201, 0.043, 0.049], + [8.133, 0.727, 0.779], + [0.438, 0.06, 0.067], + [1.562, 0.088, 0.067], + [3.965, 0.088, 0.078], + [4.009, 0.455, 0.37], + [9.844, 0.364, 0.336], + [9.791, 0.355, 0.326], + [0.702, 0.061, 0.073], + [0.858, 0.087, 0.092], + [0.414, 0.044, 0.036], + [0.807, 0.03, 0.029], + [1.312, 0.19, 0.154], + [0.429, 0.02, 0.019], + [0.396, 0.03, 0.012], + [0.28, 0.022, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-z1/start b/clickhouse-i114640-z1/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-z1/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-z1/stop b/clickhouse-i114640-z1/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-z1/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-z1/template.json b/clickhouse-i114640-z1/template.json new file mode 100644 index 0000000000..9bb7edd74f --- /dev/null +++ b/clickhouse-i114640-z1/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Z1 pre-107490)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +} diff --git a/clickhouse-i114640-z2/benchmark.sh b/clickhouse-i114640-z2/benchmark.sh new file mode 100755 index 0000000000..6a7f75fd0f --- /dev/null +++ b/clickhouse-i114640-z2/benchmark.sh @@ -0,0 +1,6 @@ +#!/bin/bash +export BENCH_DOWNLOAD_SCRIPT="download-hits-parquet-partitioned" +# Skip the concurrent-QPS phase: this system exists only for the per-query +# A/B of https://github.com/ClickHouse/ClickHouse/issues/114640. +export BENCH_CONCURRENT_DURATION=0 +exec ../lib/benchmark-common.sh diff --git a/clickhouse-i114640-z2/check b/clickhouse-i114640-z2/check new file mode 100755 index 0000000000..febe4e0de2 --- /dev/null +++ b/clickhouse-i114640-z2/check @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT 1" >/dev/null diff --git a/clickhouse-i114640-z2/create.sql b/clickhouse-i114640-z2/create.sql new file mode 100644 index 0000000000..a6311a5a8c --- /dev/null +++ b/clickhouse-i114640-z2/create.sql @@ -0,0 +1,112 @@ +CREATE OR REPLACE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime TIMESTAMP NOT NULL, + EventDate Date NOT NULL, + CounterID INTEGER NOT NULL, + ClientIP INTEGER NOT NULL, + RegionID INTEGER NOT NULL, + UserID BIGINT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL TEXT NOT NULL, + Referer TEXT NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INTEGER NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INTEGER NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 TEXT NOT NULL, + NetMajor SMALLINT NOT NULL, + NetMinor SMALLINT NOT NULL, + UserAgentMajor SMALLINT NOT NULL, + UserAgentMinor VARCHAR(255) NOT NULL, + CookieEnable SMALLINT NOT NULL, + JavascriptEnable SMALLINT NOT NULL, + IsMobile SMALLINT NOT NULL, + MobilePhone SMALLINT NOT NULL, + MobilePhoneModel TEXT NOT NULL, + Params TEXT NOT NULL, + IPNetworkID INTEGER NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase TEXT NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime TIMESTAMP NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INTEGER NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset TEXT NOT NULL, + CodeVersion INTEGER NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL TEXT NOT NULL, + HID INTEGER NOT NULL, + IsOldCounter SMALLINT NOT NULL, + IsEvent SMALLINT NOT NULL, + IsParameter SMALLINT NOT NULL, + DontCountHits SMALLINT NOT NULL, + WithHash SMALLINT NOT NULL, + HitColor CHAR NOT NULL, + LocalEventTime TIMESTAMP NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INTEGER NOT NULL, + WindowName INTEGER NOT NULL, + OpenerName INTEGER NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage TEXT NOT NULL, + BrowserCountry TEXT NOT NULL, + SocialNetwork TEXT NOT NULL, + SocialAction TEXT NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INTEGER NOT NULL, + DNSTiming INTEGER NOT NULL, + ConnectTiming INTEGER NOT NULL, + ResponseStartTiming INTEGER NOT NULL, + ResponseEndTiming INTEGER NOT NULL, + FetchTiming INTEGER NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage TEXT NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID TEXT NOT NULL, + ParamCurrency TEXT NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName TEXT NOT NULL, + OpenstatCampaignID TEXT NOT NULL, + OpenstatAdID TEXT NOT NULL, + OpenstatSourceID TEXT NOT NULL, + UTMSource TEXT NOT NULL, + UTMMedium TEXT NOT NULL, + UTMCampaign TEXT NOT NULL, + UTMContent TEXT NOT NULL, + UTMTerm TEXT NOT NULL, + FromTag TEXT NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INTEGER NOT NULL, + PRIMARY KEY (CounterID, EventDate, UserID, EventTime, WatchID) +) +ENGINE = MergeTree +SETTINGS fsync_after_insert = 1, -- https://github.com/ClickHouse/ClickBench/issues/678 + auto_statistics_types = ''; -- per-column uniqState blobs grow with cardinality (~140 KB for high-card columns × ~30 such columns ≈ 4 MB per part of statistics.packed). Cold queries pay the load cost before cached_estimator is populated by the bg refresh task. Disabling stops the auto-stats files from being created on merge. diff --git a/clickhouse-i114640-z2/data-size b/clickhouse-i114640-z2/data-size new file mode 100755 index 0000000000..7770f6efb6 --- /dev/null +++ b/clickhouse-i114640-z2/data-size @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +clickhouse-client --query "SELECT total_bytes FROM system.tables WHERE name = 'hits' AND database = 'default'" diff --git a/clickhouse-i114640-z2/install b/clickhouse-i114640-z2/install new file mode 100755 index 0000000000..10a94d6e61 --- /dev/null +++ b/clickhouse-i114640-z2/install @@ -0,0 +1,45 @@ +#!/bin/bash +set -e -o pipefail + +# Round 6 of the A/B for https://github.com/ClickHouse/ClickHouse/issues/114640: +# surgical straddle of #107490 (Aggregator memory usage accounting, merged +# 8fa9200c0a8 on 07-01 07:35). Round 5 isolated the Q10/Q11 flip to +# 07-01 02:50 .. 07-02 10:05 and proved it is NOT query-condition-cache +# related; #107490 changes the accounting that feeds the aggregation +# two-level-conversion bytes threshold. Z2: master @ 32129f76fca (07-01 07:39, 4 minutes AFTER #107490; only #107490 and a CI-only fuzz PR in between). +SHA=32129f76fca7904f4b219e678d9426a08e965ffd + +if [ ! -x /usr/bin/clickhouse ]; then + curl -fsSL --retry 10 --retry-delay 10 --retry-all-errors -o clickhouse \ + "https://clickhouse-builds.s3.amazonaws.com/REFs/master/${SHA}/build_amd_release/clickhouse" + chmod +x clickhouse + sudo ./clickhouse install --noninteractive +fi + +# Force synchronous startup loading so the cold timer doesn't catch +# work that should have been amortized into ./start. +# +# Two independent layers of laziness contribute to the cold-query floor: +# +# 1. async_load_databases (server-level): with the default 1, the server +# binds its listen port and answers SELECT 1 before user databases +# have finished loading. ./check passes, then the first query stalls +# waiting for the part loader. +# +# 2. primary_key_lazy_load and columns_and_secondary_indices_sizes_lazy_calculation +# (MergeTree-level): even after parts are loaded, the in-memory +# primary key and the per-column .size streams are populated lazily +# on first query. With ~25 parts × ~80 columns × multiple metadata +# files per column that's >1.8k file opens on the first query path, +# contributing several hundred ms even on local NVMe. +# +# Both are eager-load toggles, not caching shortcuts: the same I/O +# happens either way, just before query timing instead of during it. +# Together they brought Q40 cold from ~3 s to ~1.5 s on c6a.4xlarge. +sudo mkdir -p /etc/clickhouse-server/config.d +sudo tee /etc/clickhouse-server/config.d/eager_load.yaml >/dev/null <<'EOF' +async_load_databases: false +merge_tree: + primary_key_lazy_load: 0 + columns_and_secondary_indices_sizes_lazy_calculation: 0 +EOF diff --git a/clickhouse-i114640-z2/load b/clickhouse-i114640-z2/load new file mode 100755 index 0000000000..df578a617c --- /dev/null +++ b/clickhouse-i114640-z2/load @@ -0,0 +1,20 @@ +#!/bin/bash +set -e + +clickhouse-client < create.sql + +# Symlink the parquet files into ClickHouse's user_files dir rather than +# moving them. mv on a 14 GB partitioned dataset wastes minutes copying +# bytes the daemon will only read once and then we delete; ln -s is +# instant. chown -h sets the symlink's owner (does not follow into the +# target), which is enough — the underlying parquets are mode 644, so +# the clickhouse user can read them through the symlinks regardless. +for f in hits_*.parquet; do + sudo ln -sf "$PWD/$f" /var/lib/clickhouse/user_files/"$f" +done +sudo chown -h clickhouse:clickhouse /var/lib/clickhouse/user_files/hits_*.parquet + +clickhouse-client --query "INSERT INTO hits SELECT * FROM file('hits_*.parquet')" --max-insert-threads "$(( $(nproc) / 4 ))" + +sudo rm -f /var/lib/clickhouse/user_files/hits_*.parquet +sync diff --git a/clickhouse-i114640-z2/queries.sql b/clickhouse-i114640-z2/queries.sql new file mode 100644 index 0000000000..31f65fc898 --- /dev/null +++ b/clickhouse-i114640-z2/queries.sql @@ -0,0 +1,43 @@ +SELECT COUNT(*) FROM hits; +SELECT COUNT(*) FROM hits WHERE AdvEngineID <> 0; +SELECT SUM(AdvEngineID), COUNT(*), AVG(ResolutionWidth) FROM hits; +SELECT AVG(UserID) FROM hits; +SELECT COUNT(DISTINCT UserID) FROM hits; +SELECT COUNT(DISTINCT SearchPhrase) FROM hits; +SELECT MIN(EventDate), MAX(EventDate) FROM hits; +SELECT AdvEngineID, COUNT(*) FROM hits WHERE AdvEngineID <> 0 GROUP BY AdvEngineID ORDER BY COUNT(*) DESC; +SELECT RegionID, COUNT(DISTINCT UserID) AS u FROM hits GROUP BY RegionID ORDER BY u DESC LIMIT 10; +SELECT RegionID, SUM(AdvEngineID), COUNT(*) AS c, AVG(ResolutionWidth), COUNT(DISTINCT UserID) FROM hits GROUP BY RegionID ORDER BY c DESC LIMIT 10; +SELECT MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT MobilePhone, MobilePhoneModel, COUNT(DISTINCT UserID) AS u FROM hits WHERE MobilePhoneModel <> '' GROUP BY MobilePhone, MobilePhoneModel ORDER BY u DESC LIMIT 10; +SELECT SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT SearchPhrase, COUNT(DISTINCT UserID) AS u FROM hits WHERE SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY u DESC LIMIT 10; +SELECT SearchEngineID, SearchPhrase, COUNT(*) AS c FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, SearchPhrase ORDER BY c DESC LIMIT 10; +SELECT UserID, COUNT(*) FROM hits GROUP BY UserID ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, SearchPhrase LIMIT 10; +SELECT UserID, extract(minute FROM EventTime) AS m, SearchPhrase, COUNT(*) FROM hits GROUP BY UserID, m, SearchPhrase ORDER BY COUNT(*) DESC LIMIT 10; +SELECT UserID FROM hits WHERE UserID = 435090932899640449; +SELECT COUNT(*) FROM hits WHERE URL LIKE '%google%'; +SELECT SearchPhrase, MIN(URL), COUNT(*) AS c FROM hits WHERE URL LIKE '%google%' AND SearchPhrase <> '' GROUP BY SearchPhrase ORDER BY c DESC LIMIT 10; +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; +SELECT * FROM hits WHERE URL LIKE '%google%' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY SearchPhrase LIMIT 10; +SELECT SearchPhrase FROM hits WHERE SearchPhrase <> '' ORDER BY EventTime, SearchPhrase LIMIT 10; +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; +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; +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; +SELECT SearchEngineID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY SearchEngineID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits WHERE SearchPhrase <> '' GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT WatchID, ClientIP, COUNT(*) AS c, SUM(IsRefresh), AVG(ResolutionWidth) FROM hits GROUP BY WatchID, ClientIP ORDER BY c DESC LIMIT 10; +SELECT URL, COUNT(*) AS c FROM hits GROUP BY URL ORDER BY c DESC LIMIT 10; +SELECT 1, URL, COUNT(*) AS c FROM hits GROUP BY 1, URL ORDER BY c DESC LIMIT 10; +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; +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; +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; +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; +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; +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; +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; +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; diff --git a/clickhouse-i114640-z2/query b/clickhouse-i114640-z2/query new file mode 100755 index 0000000000..6d5c47fb11 --- /dev/null +++ b/clickhouse-i114640-z2/query @@ -0,0 +1,8 @@ +#!/bin/bash +# Reads a SQL query from stdin, runs it via clickhouse-client. +# Stdout: query result (default format). +# Stderr: query runtime in fractional seconds on the last line (from --time). +# Exit non-zero on error. +set -e + +clickhouse-client --time --format=Pretty diff --git a/clickhouse-i114640-z2/results/20260813/c7a.metal-48xl.json b/clickhouse-i114640-z2/results/20260813/c7a.metal-48xl.json new file mode 100644 index 0000000000..53da1c7a54 --- /dev/null +++ b/clickhouse-i114640-z2/results/20260813/c7a.metal-48xl.json @@ -0,0 +1,60 @@ +{ + "system": "ClickHouse (i114640 Z2 post-107490)", + "date": "2026-08-13", + "machine": "c7a.metal-48xl", + "cluster_size": 1, + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": ["C++","column-oriented","ClickHouse derivative"], + "load_time": 258, + "data_size": 15265055524, + "concurrent_qps": null, + "concurrent_error_ratio": null, + "result": [ + [0.002, 0.001, 0.001], + [0.125, 0.011, 0.011], + [0.415, 0.014, 0.013], + [0.963, 0.023, 0.012], + [1.036, 0.076, 0.065], + [1.939, 0.094, 0.101], + [0.109, 0.01, 0.01], + [0.118, 0.018, 0.045], + [1.523, 0.249, 0.249], + [1.895, 0.243, 0.234], + [1.799, 0.429, 0.297], + [1.576, 0.277, 0.165], + [2.041, 0.101, 0.093], + [2.735, 0.138, 0.124], + [2.099, 0.103, 0.079], + [0.995, 0.064, 0.057], + [2.663, 0.157, 0.154], + [2.758, 0.137, 0.148], + [4.211, 0.273, 0.269], + [0.628, 0.003, 0.002], + [9.579, 0.047, 0.047], + [11.034, 0.024, 0.022], + [13.929, 0.075, 0.067], + [5.488, 0.078, 0.072], + [1.915, 0.161, 0.131], + [1.806, 0.037, 0.028], + [1.919, 0.739, 0.145], + [1.156, 0.027, 0.026], + [8.194, 0.714, 0.703], + [0.405, 0.063, 0.049], + [1.59, 0.072, 0.068], + [3.794, 0.089, 0.072], + [3.906, 0.504, 0.377], + [9.898, 0.327, 0.339], + [9.961, 0.358, 0.348], + [0.707, 0.057, 0.049], + [0.898, 0.084, 0.08], + [0.477, 0.051, 0.053], + [0.963, 0.026, 0.031], + [1.574, 0.178, 0.136], + [0.517, 0.02, 0.018], + [0.507, 0.014, 0.013], + [0.418, 0.031, 0.011] +] + } + \ No newline at end of file diff --git a/clickhouse-i114640-z2/start b/clickhouse-i114640-z2/start new file mode 100755 index 0000000000..a3aa66fe75 --- /dev/null +++ b/clickhouse-i114640-z2/start @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +sudo clickhouse start diff --git a/clickhouse-i114640-z2/stop b/clickhouse-i114640-z2/stop new file mode 100755 index 0000000000..ea9d529c3e --- /dev/null +++ b/clickhouse-i114640-z2/stop @@ -0,0 +1,3 @@ +#!/bin/bash + +sudo clickhouse stop || true diff --git a/clickhouse-i114640-z2/template.json b/clickhouse-i114640-z2/template.json new file mode 100644 index 0000000000..3c26405622 --- /dev/null +++ b/clickhouse-i114640-z2/template.json @@ -0,0 +1,11 @@ +{ + "system": "ClickHouse (i114640 Z2 post-107490)", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "ClickHouse derivative" + ] +}