From e455c727fe3c8cd050556e6033d53e48a6b61587 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 8 May 2026 20:56:11 +0000 Subject: [PATCH 1/2] Add Hyrise Closes #751 Hyrise is a research in-memory column-oriented database from HPI (https://github.com/hyrise/hyrise). It implements the PostgreSQL wire protocol, so the benchmark connects via psql and uses Hyrise's COPY ... WITH (FORMAT CSV) to load the standard ClickBench CSV dataset. The system is built from source via Hyrise's install_dependencies.sh and cmake/ninja; install_dependencies.sh requires Ubuntu 25.04 or newer. Since Hyrise has no on-disk persistence, the data size is reported as the total estimated segment size from the meta_segments meta table. Hyrise has limited SQL coverage (no DATE/DATETIME types, no REGEXP_REPLACE, no DATE_TRUNC). Queries that use unsupported functions are kept verbatim and will be reported as null in the result file. Co-Authored-By: Claude Opus 4.7 (1M context) --- hyrise/benchmark.sh | 67 +++++++++++++++++++++++++++ hyrise/create.sql | 108 +++++++++++++++++++++++++++++++++++++++++++ hyrise/queries.sql | 43 +++++++++++++++++ hyrise/run.sh | 13 ++++++ hyrise/template.json | 12 +++++ 5 files changed, 243 insertions(+) create mode 100755 hyrise/benchmark.sh create mode 100644 hyrise/create.sql create mode 100644 hyrise/queries.sql create mode 100755 hyrise/run.sh create mode 100644 hyrise/template.json diff --git a/hyrise/benchmark.sh b/hyrise/benchmark.sh new file mode 100755 index 000000000..787bc8c35 --- /dev/null +++ b/hyrise/benchmark.sh @@ -0,0 +1,67 @@ +#!/bin/bash -e + +# Hyrise is a research in-memory column-oriented database from HPI. +# https://github.com/hyrise/hyrise +# +# Hyrise has no pre-built binary distribution; it must be compiled from source. +# Hyrise's install_dependencies.sh requires Ubuntu 25.04 or newer (for gcc-15 +# and clang-20). On older Ubuntu releases the build will fail. + +# Install Hyrise dependencies (this may pull in many packages and a fresh +# compiler toolchain). +sudo apt-get update -y +sudo apt-get install -y git cmake ninja-build postgresql-client + +git clone --recursive https://github.com/hyrise/hyrise.git hyrise-src +cd hyrise-src +HYRISE_HEADLESS_SETUP=1 ./install_dependencies.sh + +# Build only the server binary in Release mode. +mkdir -p cmake-build-release +cd cmake-build-release +cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. +ninja hyriseServer +cd ../.. + +# Download the dataset (CSV format, RFC-4180 compliant). +../download-hits-csv + +# Start the server in the background. Hyrise listens on the PostgreSQL wire +# protocol; no authentication is required. +./hyrise-src/cmake-build-release/hyriseServer 5432 > server.log 2>&1 & +SERVER_PID=$! + +# Wait for the server to accept connections. +for _ in $(seq 1 60); do + if psql -h 127.0.0.1 -p 5432 -U postgres -c 'SELECT 1' > /dev/null 2>&1; then + break + fi + sleep 1 +done + +# Create the table. +psql -h 127.0.0.1 -p 5432 -U postgres -f create.sql + +# Load the data and measure load time. The COPY statement uses Hyrise's CSV +# parser, which expects RFC-4180 formatted input (the format produced by +# download-hits-csv). +echo -n "Load time: " +command time -f '%e' psql -h 127.0.0.1 -p 5432 -U postgres -c "COPY hits FROM '$(pwd)/hits.csv' WITH (FORMAT CSV);" + +# Hyrise is in-memory only, so report the estimated total segment size of the +# hits table as the data size. +echo -n "Data size: " +psql -h 127.0.0.1 -p 5432 -U postgres -t -A -c \ + "SELECT SUM(estimated_size_in_bytes) FROM meta_segments WHERE table_name = 'hits';" + +# Run the benchmark. +./run.sh 2>&1 | tee log.txt + +# Pretty-print results: 43 lines of [t1, t2, t3] (seconds). +cat log.txt | grep -oP 'Time: \d+\.\d+ ms|psql: error' | + sed -r -e 's/Time: ([0-9]+\.[0-9]+) ms/\1/; s/^.*psql: error.*$/null/' | + awk '{ if (i % 3 == 0) { printf "[" }; if ($1 == "null") { printf $1 } else { printf $1 / 1000 }; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' + +# Cleanup. +kill ${SERVER_PID} || true +wait ${SERVER_PID} 2>/dev/null || true diff --git a/hyrise/create.sql b/hyrise/create.sql new file mode 100644 index 000000000..9b4f19beb --- /dev/null +++ b/hyrise/create.sql @@ -0,0 +1,108 @@ +CREATE TABLE hits +( + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title TEXT NOT NULL, + GoodEvent SMALLINT NOT NULL, + EventTime DATETIME 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 DATETIME 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 VARCHAR(1) NOT NULL, + LocalEventTime DATETIME 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 +); diff --git a/hyrise/queries.sql b/hyrise/queries.sql new file mode 100644 index 000000000..e29663a7b --- /dev/null +++ b/hyrise/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/hyrise/run.sh b/hyrise/run.sh new file mode 100755 index 000000000..76df8ea3b --- /dev/null +++ b/hyrise/run.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +TRIES=3 + +cat queries.sql | while read -r query; do + sync + echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null + + echo "$query"; + for i in $(seq 1 $TRIES); do + psql -h 127.0.0.1 -p 5432 -U postgres -t -c '\timing' -c "$query" 2>&1 | grep -P 'Time|psql: error' | tail -n1 + done +done diff --git a/hyrise/template.json b/hyrise/template.json new file mode 100644 index 000000000..6800d778d --- /dev/null +++ b/hyrise/template.json @@ -0,0 +1,12 @@ +{ + "system": "Hyrise", + "proprietary": "no", + "hardware": "cpu", + "tuned": "no", + "tags": [ + "C++", + "column-oriented", + "in-memory", + "PostgreSQL compatible" + ] +} From 16dd89b3489f90368737bae0c95a8a6d5ffaeeee Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 8 May 2026 22:01:32 +0000 Subject: [PATCH 2/2] hyrise: build inside Docker, load via CSV meta JSON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the build into a multi-stage Dockerfile (ubuntu:25.04 + gcc-15) so the benchmark works on any Ubuntu host without polluting it with Hyrise's toolchain. The runtime image only carries hyriseServer, libhyrise_impl.so, libjemalloc.so, and a small set of shared-library deps (~250 MB). Build args: - HYRISE_REF (default master) — pin a Hyrise revision - NO_LTO (default FALSE) — toggle LTO for faster development builds Loading: drop create.sql and use hits.csv.json next to the data file as the schema source. CREATE TABLE followed by COPY trips a Hyrise assertion ("set_immutable() should not be called on an empty chunk", chunk.cpp:125) because COPY tries to seal the empty chunk left by CREATE TABLE; letting COPY auto-create the table from the CSV meta avoids the issue. run.sh: detect failed queries via psql's exit code rather than grepping the output, so errors like "Invalid input error: Could not resolve function 'LENGTH'" are recorded as null. Hyrise lacks LENGTH, REGEXP_REPLACE, DATE_TRUNC, and OFFSET, so 7 queries (Q28, Q29, Q39-Q43) are reported as null; the remaining 36 succeed. Tested locally on arm64: docker build produced a working image, hyriseServer accepts psql connections, COPY loads a 1000-row sample, and run.sh produces the expected 43 lines of [t1,t2,t3] output with nulls in the right slots. Co-Authored-By: Claude Opus 4.7 (1M context) --- hyrise/Dockerfile | 82 ++++++++++++++++++++++++++++++ hyrise/benchmark.sh | 75 +++++++++++++--------------- hyrise/create.sql | 108 ---------------------------------------- hyrise/hits.csv.json | 116 +++++++++++++++++++++++++++++++++++++++++++ hyrise/run.sh | 8 ++- 5 files changed, 239 insertions(+), 150 deletions(-) create mode 100644 hyrise/Dockerfile delete mode 100644 hyrise/create.sql create mode 100644 hyrise/hits.csv.json diff --git a/hyrise/Dockerfile b/hyrise/Dockerfile new file mode 100644 index 000000000..d0bc92ae3 --- /dev/null +++ b/hyrise/Dockerfile @@ -0,0 +1,82 @@ +FROM ubuntu:25.04 AS build + +ENV DEBIAN_FRONTEND=noninteractive +ENV HYRISE_HEADLESS_SETUP=1 + +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + autoconf \ + bash-completion \ + bc \ + ca-certificates \ + clang-19 \ + clang-20 \ + cmake \ + curl \ + dos2unix \ + g++-13 \ + g++-15 \ + gcc-13 \ + gcc-15 \ + git \ + libboost-all-dev \ + libhwloc-dev \ + libncurses-dev \ + libnuma-dev \ + libnuma1 \ + libpq-dev \ + libreadline-dev \ + libsqlite3-dev \ + libtbb-dev \ + lld-20 \ + llvm-20 \ + lsb-release \ + make \ + ninja-build \ + parallel \ + postgresql-server-dev-all \ + python3 \ + python3-pip \ + software-properties-common \ + sudo \ + && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 90 --slave /usr/bin/g++ g++ /usr/bin/g++-15 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +# Pin a specific Hyrise revision for reproducibility (defaults to master). +ARG HYRISE_REF=master +# Set NO_LTO=TRUE to disable Link Time Optimization (much faster build, slightly +# lower runtime performance — useful for development/testing). Default: LTO on. +ARG NO_LTO=FALSE + +WORKDIR /opt +RUN git clone https://github.com/hyrise/hyrise.git \ + && cd hyrise \ + && git checkout "${HYRISE_REF}" \ + && git submodule update --jobs 8 --init --recursive --depth 1 + +WORKDIR /opt/hyrise/cmake-build-release +RUN cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DNO_LTO=${NO_LTO} .. \ + && ninja hyriseServer + +FROM ubuntu:25.04 +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update \ + && apt-get install -y --no-install-recommends \ + libboost-system1.83.0 \ + libboost-thread1.83.0 \ + libhwloc15 \ + libnuma1 \ + libsqlite3-0 \ + libtbb12 \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* + +COPY --from=build /opt/hyrise/cmake-build-release/hyriseServer /usr/local/bin/hyriseServer +COPY --from=build /opt/hyrise/cmake-build-release/lib/libhyrise_impl.so /usr/local/lib/ +COPY --from=build /opt/hyrise/cmake-build-release/third_party/jemalloc/lib/libjemalloc.so.2 /usr/local/lib/ +RUN ldconfig + +EXPOSE 5432 +ENTRYPOINT ["/usr/local/bin/hyriseServer"] +CMD ["5432"] diff --git a/hyrise/benchmark.sh b/hyrise/benchmark.sh index 787bc8c35..331b3cad7 100755 --- a/hyrise/benchmark.sh +++ b/hyrise/benchmark.sh @@ -1,58 +1,53 @@ #!/bin/bash -e -# Hyrise is a research in-memory column-oriented database from HPI. +# Hyrise: research in-memory column-oriented DBMS from HPI. # https://github.com/hyrise/hyrise # -# Hyrise has no pre-built binary distribution; it must be compiled from source. -# Hyrise's install_dependencies.sh requires Ubuntu 25.04 or newer (for gcc-15 -# and clang-20). On older Ubuntu releases the build will fail. +# Hyrise has no upstream binary distribution and the build requires a recent +# toolchain (gcc-15 / clang-20). We build it inside Docker on top of Ubuntu +# 25.04, then ship just the binary and its runtime libs in a slim image. -# Install Hyrise dependencies (this may pull in many packages and a fresh -# compiler toolchain). sudo apt-get update -y -sudo apt-get install -y git cmake ninja-build postgresql-client - -git clone --recursive https://github.com/hyrise/hyrise.git hyrise-src -cd hyrise-src -HYRISE_HEADLESS_SETUP=1 ./install_dependencies.sh - -# Build only the server binary in Release mode. -mkdir -p cmake-build-release -cd cmake-build-release -cmake -GNinja -DCMAKE_BUILD_TYPE=Release .. -ninja hyriseServer -cd ../.. - -# Download the dataset (CSV format, RFC-4180 compliant). -../download-hits-csv - -# Start the server in the background. Hyrise listens on the PostgreSQL wire -# protocol; no authentication is required. -./hyrise-src/cmake-build-release/hyriseServer 5432 > server.log 2>&1 & -SERVER_PID=$! +sudo apt-get install -y docker.io postgresql-client gzip + +# Build the Hyrise server image. +sudo docker build -t clickbench-hyrise . + +# Download the dataset (RFC-4180 CSV produced by ClickHouse). +rm -rf data +mkdir data +../download-hits-csv data +# hits.csv.json next to hits.csv tells Hyrise's CSV parser the column types. +cp hits.csv.json data/hits.csv.json +chmod -R 777 data + +# Start the server. Hyrise is in-memory only, so no persistent volume is +# needed; the dataset is mounted read-only. +sudo docker run -d --name hyrise --rm -p 5432:5432 \ + -v "$(pwd)/data:/data:ro" \ + --ulimit nofile=1048576:1048576 \ + clickbench-hyrise # Wait for the server to accept connections. -for _ in $(seq 1 60); do +for _ in $(seq 1 120); do if psql -h 127.0.0.1 -p 5432 -U postgres -c 'SELECT 1' > /dev/null 2>&1; then break fi sleep 1 done -# Create the table. -psql -h 127.0.0.1 -p 5432 -U postgres -f create.sql - -# Load the data and measure load time. The COPY statement uses Hyrise's CSV -# parser, which expects RFC-4180 formatted input (the format produced by -# download-hits-csv). +# Load the data. The COPY statement creates the `hits` table from the column +# definitions in hits.csv.json next to the data file. echo -n "Load time: " -command time -f '%e' psql -h 127.0.0.1 -p 5432 -U postgres -c "COPY hits FROM '$(pwd)/hits.csv' WITH (FORMAT CSV);" +command time -f '%e' \ + psql -h 127.0.0.1 -p 5432 -U postgres -q \ + -c "COPY hits FROM '/data/hits.csv' WITH (FORMAT CSV);" -# Hyrise is in-memory only, so report the estimated total segment size of the -# hits table as the data size. +# Hyrise has no on-disk persistence; report the total in-memory segment size +# of the hits table from the meta_segments meta table. echo -n "Data size: " -psql -h 127.0.0.1 -p 5432 -U postgres -t -A -c \ - "SELECT SUM(estimated_size_in_bytes) FROM meta_segments WHERE table_name = 'hits';" +psql -h 127.0.0.1 -p 5432 -U postgres -t -A \ + -c "SELECT SUM(estimated_size_in_bytes) FROM meta_segments WHERE table_name = 'hits';" # Run the benchmark. ./run.sh 2>&1 | tee log.txt @@ -63,5 +58,5 @@ cat log.txt | grep -oP 'Time: \d+\.\d+ ms|psql: error' | awk '{ if (i % 3 == 0) { printf "[" }; if ($1 == "null") { printf $1 } else { printf $1 / 1000 }; if (i % 3 != 2) { printf "," } else { print "]," }; ++i; }' # Cleanup. -kill ${SERVER_PID} || true -wait ${SERVER_PID} 2>/dev/null || true +sudo docker stop hyrise > /dev/null 2>&1 || true +rm -rf data diff --git a/hyrise/create.sql b/hyrise/create.sql deleted file mode 100644 index 9b4f19beb..000000000 --- a/hyrise/create.sql +++ /dev/null @@ -1,108 +0,0 @@ -CREATE TABLE hits -( - WatchID BIGINT NOT NULL, - JavaEnable SMALLINT NOT NULL, - Title TEXT NOT NULL, - GoodEvent SMALLINT NOT NULL, - EventTime DATETIME 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 DATETIME 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 VARCHAR(1) NOT NULL, - LocalEventTime DATETIME 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 -); diff --git a/hyrise/hits.csv.json b/hyrise/hits.csv.json new file mode 100644 index 000000000..e509bda8f --- /dev/null +++ b/hyrise/hits.csv.json @@ -0,0 +1,116 @@ +{ + "config": { + "rfc_mode": true, + "separator": ",", + "quote": "\"", + "escape": "\"", + "delimiter": "\n" + }, + "columns": [ + {"name": "WatchID", "type": "long", "nullable": false}, + {"name": "JavaEnable", "type": "int", "nullable": false}, + {"name": "Title", "type": "string", "nullable": false}, + {"name": "GoodEvent", "type": "int", "nullable": false}, + {"name": "EventTime", "type": "string", "nullable": false}, + {"name": "EventDate", "type": "string", "nullable": false}, + {"name": "CounterID", "type": "int", "nullable": false}, + {"name": "ClientIP", "type": "int", "nullable": false}, + {"name": "RegionID", "type": "int", "nullable": false}, + {"name": "UserID", "type": "long", "nullable": false}, + {"name": "CounterClass", "type": "int", "nullable": false}, + {"name": "OS", "type": "int", "nullable": false}, + {"name": "UserAgent", "type": "int", "nullable": false}, + {"name": "URL", "type": "string", "nullable": false}, + {"name": "Referer", "type": "string", "nullable": false}, + {"name": "IsRefresh", "type": "int", "nullable": false}, + {"name": "RefererCategoryID", "type": "int", "nullable": false}, + {"name": "RefererRegionID", "type": "int", "nullable": false}, + {"name": "URLCategoryID", "type": "int", "nullable": false}, + {"name": "URLRegionID", "type": "int", "nullable": false}, + {"name": "ResolutionWidth", "type": "int", "nullable": false}, + {"name": "ResolutionHeight", "type": "int", "nullable": false}, + {"name": "ResolutionDepth", "type": "int", "nullable": false}, + {"name": "FlashMajor", "type": "int", "nullable": false}, + {"name": "FlashMinor", "type": "int", "nullable": false}, + {"name": "FlashMinor2", "type": "string", "nullable": false}, + {"name": "NetMajor", "type": "int", "nullable": false}, + {"name": "NetMinor", "type": "int", "nullable": false}, + {"name": "UserAgentMajor", "type": "int", "nullable": false}, + {"name": "UserAgentMinor", "type": "string", "nullable": false}, + {"name": "CookieEnable", "type": "int", "nullable": false}, + {"name": "JavascriptEnable", "type": "int", "nullable": false}, + {"name": "IsMobile", "type": "int", "nullable": false}, + {"name": "MobilePhone", "type": "int", "nullable": false}, + {"name": "MobilePhoneModel", "type": "string", "nullable": false}, + {"name": "Params", "type": "string", "nullable": false}, + {"name": "IPNetworkID", "type": "int", "nullable": false}, + {"name": "TraficSourceID", "type": "int", "nullable": false}, + {"name": "SearchEngineID", "type": "int", "nullable": false}, + {"name": "SearchPhrase", "type": "string", "nullable": false}, + {"name": "AdvEngineID", "type": "int", "nullable": false}, + {"name": "IsArtifical", "type": "int", "nullable": false}, + {"name": "WindowClientWidth", "type": "int", "nullable": false}, + {"name": "WindowClientHeight", "type": "int", "nullable": false}, + {"name": "ClientTimeZone", "type": "int", "nullable": false}, + {"name": "ClientEventTime", "type": "string", "nullable": false}, + {"name": "SilverlightVersion1", "type": "int", "nullable": false}, + {"name": "SilverlightVersion2", "type": "int", "nullable": false}, + {"name": "SilverlightVersion3", "type": "int", "nullable": false}, + {"name": "SilverlightVersion4", "type": "int", "nullable": false}, + {"name": "PageCharset", "type": "string", "nullable": false}, + {"name": "CodeVersion", "type": "int", "nullable": false}, + {"name": "IsLink", "type": "int", "nullable": false}, + {"name": "IsDownload", "type": "int", "nullable": false}, + {"name": "IsNotBounce", "type": "int", "nullable": false}, + {"name": "FUniqID", "type": "long", "nullable": false}, + {"name": "OriginalURL", "type": "string", "nullable": false}, + {"name": "HID", "type": "int", "nullable": false}, + {"name": "IsOldCounter", "type": "int", "nullable": false}, + {"name": "IsEvent", "type": "int", "nullable": false}, + {"name": "IsParameter", "type": "int", "nullable": false}, + {"name": "DontCountHits", "type": "int", "nullable": false}, + {"name": "WithHash", "type": "int", "nullable": false}, + {"name": "HitColor", "type": "string", "nullable": false}, + {"name": "LocalEventTime", "type": "string", "nullable": false}, + {"name": "Age", "type": "int", "nullable": false}, + {"name": "Sex", "type": "int", "nullable": false}, + {"name": "Income", "type": "int", "nullable": false}, + {"name": "Interests", "type": "int", "nullable": false}, + {"name": "Robotness", "type": "int", "nullable": false}, + {"name": "RemoteIP", "type": "int", "nullable": false}, + {"name": "WindowName", "type": "int", "nullable": false}, + {"name": "OpenerName", "type": "int", "nullable": false}, + {"name": "HistoryLength", "type": "int", "nullable": false}, + {"name": "BrowserLanguage", "type": "string", "nullable": false}, + {"name": "BrowserCountry", "type": "string", "nullable": false}, + {"name": "SocialNetwork", "type": "string", "nullable": false}, + {"name": "SocialAction", "type": "string", "nullable": false}, + {"name": "HTTPError", "type": "int", "nullable": false}, + {"name": "SendTiming", "type": "int", "nullable": false}, + {"name": "DNSTiming", "type": "int", "nullable": false}, + {"name": "ConnectTiming", "type": "int", "nullable": false}, + {"name": "ResponseStartTiming", "type": "int", "nullable": false}, + {"name": "ResponseEndTiming", "type": "int", "nullable": false}, + {"name": "FetchTiming", "type": "int", "nullable": false}, + {"name": "SocialSourceNetworkID", "type": "int", "nullable": false}, + {"name": "SocialSourcePage", "type": "string", "nullable": false}, + {"name": "ParamPrice", "type": "long", "nullable": false}, + {"name": "ParamOrderID", "type": "string", "nullable": false}, + {"name": "ParamCurrency", "type": "string", "nullable": false}, + {"name": "ParamCurrencyID", "type": "int", "nullable": false}, + {"name": "OpenstatServiceName", "type": "string", "nullable": false}, + {"name": "OpenstatCampaignID", "type": "string", "nullable": false}, + {"name": "OpenstatAdID", "type": "string", "nullable": false}, + {"name": "OpenstatSourceID", "type": "string", "nullable": false}, + {"name": "UTMSource", "type": "string", "nullable": false}, + {"name": "UTMMedium", "type": "string", "nullable": false}, + {"name": "UTMCampaign", "type": "string", "nullable": false}, + {"name": "UTMContent", "type": "string", "nullable": false}, + {"name": "UTMTerm", "type": "string", "nullable": false}, + {"name": "FromTag", "type": "string", "nullable": false}, + {"name": "HasGCLID", "type": "int", "nullable": false}, + {"name": "RefererHash", "type": "long", "nullable": false}, + {"name": "URLHash", "type": "long", "nullable": false}, + {"name": "CLID", "type": "int", "nullable": false} + ] +} diff --git a/hyrise/run.sh b/hyrise/run.sh index 76df8ea3b..77a9fc96b 100755 --- a/hyrise/run.sh +++ b/hyrise/run.sh @@ -6,8 +6,12 @@ cat queries.sql | while read -r query; do sync echo 3 | sudo tee /proc/sys/vm/drop_caches > /dev/null - echo "$query"; + echo "$query" for i in $(seq 1 $TRIES); do - psql -h 127.0.0.1 -p 5432 -U postgres -t -c '\timing' -c "$query" 2>&1 | grep -P 'Time|psql: error' | tail -n1 + if output=$(psql -h 127.0.0.1 -p 5432 -U postgres -t -c '\timing' -c "$query" 2>&1); then + echo "$output" | grep -oP 'Time: \d+\.\d+ ms' | tail -n1 + else + echo "psql: error" + fi done done