diff --git a/selectdb/README.md b/selectdb/README.md new file mode 100644 index 000000000..a67af26ff --- /dev/null +++ b/selectdb/README.md @@ -0,0 +1 @@ +[SelectDB](https://selectdb.com/), the enterprise-grade cloud-native distribution for [Apache Doris](https://github.com/apache/doris). \ No newline at end of file diff --git a/selectdb/benchmark.sh b/selectdb/benchmark.sh new file mode 100755 index 000000000..2fbaba6b9 --- /dev/null +++ b/selectdb/benchmark.sh @@ -0,0 +1,117 @@ +#!/bin/bash +set -ex + +# This benchmark should run on Ubuntu 20.04 + +# Install +ROOT=$(pwd) + +if [[ -n "$1" ]]; then + url="$1" +else + url='https://qa-build.oss-cn-beijing.aliyuncs.com/enterprise-doris-release-output/selectdb-doris-2.1.7-rc01-bin-x64.tar.gz' +fi +# Download +file_name="$(basename ${url})" +if [[ "$url" == "http"* ]]; then + if [[ ! -f $file_name ]]; then + wget --no-verbose --continue ${url} + else + echo "$file_name already exists, no need to download." + fi +fi +dir_name="${file_name/.tar.gz/}" + +# Try to stop SelectDB and remove it first if execute this script multiple times +set +e +"$dir_name"/selectdb-doris-2.1.7-rc01-bin-x64/fe/bin/stop_fe.sh +"$dir_name"/selectdb-doris-2.1.7-rc01-bin-x64/be/bin/stop_be.sh +rm -rf "$dir_name" +set -e + +# Uncompress +mkdir "$dir_name" +tar zxf "$file_name" -C "$dir_name" +DORIS_HOME="$ROOT/$dir_name/selectdb-doris-2.1.7-rc01-bin-x64" +export DORIS_HOME + +# Install dependencies +sudo apt update +sudo apt install -y openjdk-17-jdk +sudo apt install -y mysql-client +export JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64/" +export PATH=$JAVA_HOME/bin:$PATH + +sudo systemctl disable unattended-upgrades +sudo systemctl stop unattended-upgrades +sudo systemctl stop mssql-server + +"$DORIS_HOME"/fe/bin/start_fe.sh --daemon + +# Start Backend +sudo sysctl -w vm.max_map_count=2000000 +ulimit -n 65535 +"$DORIS_HOME"/be/bin/start_be.sh --daemon + +# Wait for Frontend ready +while true; do + fe_version=$(mysql -h127.0.0.1 -P9030 -uroot -e 'show frontends' | cut -f16 | sed -n '2,$p') + if [[ -n "${fe_version}" ]] && [[ "${fe_version}" != "NULL" ]]; then + echo "Frontend version: ${fe_version}" + break + else + echo 'Wait for Frontend ready ...' + sleep 2 + fi +done + +# Setup cluster, add Backend to cluster +mysql -h 127.0.0.1 -P9030 -uroot -e "ALTER SYSTEM ADD BACKEND '127.0.0.1:9050' " + +# Wait for Backend ready +while true; do + be_version=$(mysql -h127.0.0.1 -P9030 -uroot -e 'show backends' | cut -f22 | sed -n '2,$p') + if [[ -n "${be_version}" ]]; then + echo "Backend version: ${be_version}" + break + else + echo 'Wait for Backend ready ...' + sleep 2 + fi +done + +echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null + +# Create Database and table +mysql -h 127.0.0.1 -P9030 -uroot -e "CREATE DATABASE hits" +sleep 5 +mysql -h 127.0.0.1 -P9030 -uroot hits <"$ROOT"/create.sql + +# Download data +if [[ ! -f hits.tsv.gz ]] && [[ ! -f hits.tsv ]]; then + wget --no-verbose --continue 'https://datasets.clickhouse.com/hits_compatible/hits.tsv.gz' + gzip -d hits.tsv.gz +fi + +# Load data +echo "start loading hits.tsv, estimated to take about 9 minutes ..." +date +START=$(date +%s) +curl --location-trusted \ + -u root: \ + -T "hits.tsv" \ + -H "label:hits" \ + -H "columns: WatchID,JavaEnable,Title,GoodEvent,EventTime,EventDate,CounterID,ClientIP,RegionID,UserID,CounterClass,OS,UserAgent,URL,Referer,IsRefresh,RefererCategoryID,RefererRegionID,URLCategoryID,URLRegionID,ResolutionWidth,ResolutionHeight,ResolutionDepth,FlashMajor,FlashMinor,FlashMinor2,NetMajor,NetMinor,UserAgentMajor,UserAgentMinor,CookieEnable,JavascriptEnable,IsMobile,MobilePhone,MobilePhoneModel,Params,IPNetworkID,TraficSourceID,SearchEngineID,SearchPhrase,AdvEngineID,IsArtifical,WindowClientWidth,WindowClientHeight,ClientTimeZone,ClientEventTime,SilverlightVersion1,SilverlightVersion2,SilverlightVersion3,SilverlightVersion4,PageCharset,CodeVersion,IsLink,IsDownload,IsNotBounce,FUniqID,OriginalURL,HID,IsOldCounter,IsEvent,IsParameter,DontCountHits,WithHash,HitColor,LocalEventTime,Age,Sex,Income,Interests,Robotness,RemoteIP,WindowName,OpenerName,HistoryLength,BrowserLanguage,BrowserCountry,SocialNetwork,SocialAction,HTTPError,SendTiming,DNSTiming,ConnectTiming,ResponseStartTiming,ResponseEndTiming,FetchTiming,SocialSourceNetworkID,SocialSourcePage,ParamPrice,ParamOrderID,ParamCurrency,ParamCurrencyID,OpenstatServiceName,OpenstatCampaignID,OpenstatAdID,OpenstatSourceID,UTMSource,UTMMedium,UTMCampaign,UTMContent,UTMTerm,FromTag,HasGCLID,RefererHash,URLHash,CLID" \ + http://localhost:8030/api/hits/hits/_stream_load +END=$(date +%s) +LOADTIME=$(echo "$END - $START" | bc) +echo "Load data costs $LOADTIME seconds" +echo "$LOADTIME" >loadtime + +# Dataset contains 99997497 rows, storage size is about 17319588503 bytes +mysql -h 127.0.0.1 -P9030 -uroot hits -e "SELECT count(*) FROM hits" +du -bs "$DORIS_HOME"/be/storage/ | cut -f1 | tee storage_size + +# Run queries +./run.sh 2>&1 | tee -a run.log +date diff --git a/selectdb/create.sql b/selectdb/create.sql new file mode 100644 index 000000000..0fd013d27 --- /dev/null +++ b/selectdb/create.sql @@ -0,0 +1,110 @@ +CREATE TABLE hits ( + CounterID INT NOT NULL, + EventDate DateV2 NOT NULL, + UserID BIGINT NOT NULL, + EventTime DateTimeV2 NOT NULL, + WatchID BIGINT NOT NULL, + JavaEnable SMALLINT NOT NULL, + Title STRING NOT NULL, + GoodEvent SMALLINT NOT NULL, + ClientIP INT NOT NULL, + RegionID INT NOT NULL, + CounterClass SMALLINT NOT NULL, + OS SMALLINT NOT NULL, + UserAgent SMALLINT NOT NULL, + URL STRING NOT NULL, + Referer STRING NOT NULL, + IsRefresh SMALLINT NOT NULL, + RefererCategoryID SMALLINT NOT NULL, + RefererRegionID INT NOT NULL, + URLCategoryID SMALLINT NOT NULL, + URLRegionID INT NOT NULL, + ResolutionWidth SMALLINT NOT NULL, + ResolutionHeight SMALLINT NOT NULL, + ResolutionDepth SMALLINT NOT NULL, + FlashMajor SMALLINT NOT NULL, + FlashMinor SMALLINT NOT NULL, + FlashMinor2 STRING 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 STRING NOT NULL, + Params STRING NOT NULL, + IPNetworkID INT NOT NULL, + TraficSourceID SMALLINT NOT NULL, + SearchEngineID SMALLINT NOT NULL, + SearchPhrase STRING NOT NULL, + AdvEngineID SMALLINT NOT NULL, + IsArtifical SMALLINT NOT NULL, + WindowClientWidth SMALLINT NOT NULL, + WindowClientHeight SMALLINT NOT NULL, + ClientTimeZone SMALLINT NOT NULL, + ClientEventTime DateTimeV2 NOT NULL, + SilverlightVersion1 SMALLINT NOT NULL, + SilverlightVersion2 SMALLINT NOT NULL, + SilverlightVersion3 INT NOT NULL, + SilverlightVersion4 SMALLINT NOT NULL, + PageCharset STRING NOT NULL, + CodeVersion INT NOT NULL, + IsLink SMALLINT NOT NULL, + IsDownload SMALLINT NOT NULL, + IsNotBounce SMALLINT NOT NULL, + FUniqID BIGINT NOT NULL, + OriginalURL STRING NOT NULL, + HID INT 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 DateTimeV2 NOT NULL, + Age SMALLINT NOT NULL, + Sex SMALLINT NOT NULL, + Income SMALLINT NOT NULL, + Interests SMALLINT NOT NULL, + Robotness SMALLINT NOT NULL, + RemoteIP INT NOT NULL, + WindowName INT NOT NULL, + OpenerName INT NOT NULL, + HistoryLength SMALLINT NOT NULL, + BrowserLanguage STRING NOT NULL, + BrowserCountry STRING NOT NULL, + SocialNetwork STRING NOT NULL, + SocialAction STRING NOT NULL, + HTTPError SMALLINT NOT NULL, + SendTiming INT NOT NULL, + DNSTiming INT NOT NULL, + ConnectTiming INT NOT NULL, + ResponseStartTiming INT NOT NULL, + ResponseEndTiming INT NOT NULL, + FetchTiming INT NOT NULL, + SocialSourceNetworkID SMALLINT NOT NULL, + SocialSourcePage STRING NOT NULL, + ParamPrice BIGINT NOT NULL, + ParamOrderID STRING NOT NULL, + ParamCurrency STRING NOT NULL, + ParamCurrencyID SMALLINT NOT NULL, + OpenstatServiceName STRING NOT NULL, + OpenstatCampaignID STRING NOT NULL, + OpenstatAdID STRING NOT NULL, + OpenstatSourceID STRING NOT NULL, + UTMSource STRING NOT NULL, + UTMMedium STRING NOT NULL, + UTMCampaign STRING NOT NULL, + UTMContent STRING NOT NULL, + UTMTerm STRING NOT NULL, + FromTag STRING NOT NULL, + HasGCLID SMALLINT NOT NULL, + RefererHash BIGINT NOT NULL, + URLHash BIGINT NOT NULL, + CLID INT NOT NULL +) +DUPLICATE KEY (CounterID, EventDate, UserID, EventTime, WatchID) +DISTRIBUTED BY HASH(UserID) BUCKETS 192 +PROPERTIES ( "replication_num"="1"); \ No newline at end of file diff --git a/selectdb/get-result-json.sh b/selectdb/get-result-json.sh new file mode 100755 index 000000000..7cb2e8da7 --- /dev/null +++ b/selectdb/get-result-json.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# set -x +if [[ ! -d results ]]; then mkdir results; fi + +echo -e "{ + \"system\": \"Apache Doris\", + \"date\": \"$(date '+%Y-%m-%d')\", + \"machine\": \"$(sudo dmidecode -s system-product-name), 500gb gp2\", + \"cluster_size\": 1, + \"comment\": \"\", + \"tags\": [\"C++\", \"column-oriented\", \"MySQL compatible\", \"ClickHouse derivative\"], + \"load_time\": $(cat loadtime), + \"data_size\": $(cat storage_size), + \"result\": [ +$( + r=$(sed -r -e 's/query[0-9]+,/[/; s/$/],/' result.csv) + echo "${r%?}" +) + ] +} +" | tee results/"$(sudo dmidecode -s system-product-name).json" + diff --git a/selectdb/queries.sql b/selectdb/queries.sql new file mode 100644 index 000000000..77ed25865 --- /dev/null +++ b/selectdb/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_FORMAT(EventTime, '%Y-%m-%d %H:%i:00') 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_FORMAT(EventTime, '%Y-%m-%d %H:%i:00') ORDER BY DATE_FORMAT(EventTime, '%Y-%m-%d %H:%i:00') LIMIT 10 OFFSET 1000; diff --git a/selectdb/results/c6a.metal.json b/selectdb/results/c6a.metal.json new file mode 100644 index 000000000..1cf1f9266 --- /dev/null +++ b/selectdb/results/c6a.metal.json @@ -0,0 +1,55 @@ +{ + "system": "SelectDB", + "date": "2024-09-19", + "machine": "c6a.metal, 500gb gp2", + "cluster_size": 1, + "comment": "", + "tags": ["C++", "column-oriented", "MySQL compatible", "ClickHouse derivative"], + "load_time": 459, + "data_size": 17365253189, + "result": [ +[0.09,0.03,0.02], +[0.13,0.02,0.03], +[1.12,0.04,0.04], +[1.70,0.04,0.04], +[1.68,0.17,0.16], +[1.40,0.21,0.20], +[0.05,0.02,0.02], +[0.18,0.03,0.03], +[2.68,0.22,0.21], +[3.57,0.25,0.25], +[2.34,0.08,0.08], +[3.10,0.08,0.08], +[2.22,0.23,0.20], +[3.76,0.29,0.26], +[2.17,0.25,0.23], +[1.48,0.12,0.12], +[3.86,0.31,0.27], +[2.82,0.36,0.09], +[4.89,0.48,0.49], +[0.04,0.01,0.02], +[11.32,0.24,0.11], +[13.35,0.12,0.06], +[25.55,0.17,0.09], +[7.56,0.06,0.07], +[2.64,0.09,0.07], +[2.26,0.05,0.06], +[3.00,0.10,0.07], +[11.58,0.24,0.22], +[9.47,0.97,0.93], +[0.50,0.05,0.03], +[5.03,0.14,0.12], +[6.98,0.17,0.15], +[4.97,0.91,0.83], +[11.65,1.06,1.01], +[11.62,1.03,0.99], +[0.89,0.18,0.16], +[1.74,0.04,0.03], +[1.97,0.03,0.03], +[2.13,0.03,0.02], +[2.25,0.08,0.08], +[1.42,0.03,0.03], +[1.82,0.02,0.03], +[1.43,0.02,0.03] + ] +} \ No newline at end of file diff --git a/selectdb/run.sh b/selectdb/run.sh new file mode 100755 index 000000000..48f23cddf --- /dev/null +++ b/selectdb/run.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +TRIES=3 +QUERY_NUM=1 +touch result.csv +truncate -s0 result.csv + +while read -r query; do + curl http://127.0.0.1:8040/api/clear_cache/all + sync + echo 3 | sudo tee /proc/sys/vm/drop_caches >/dev/null + + echo -n "query${QUERY_NUM}," | tee -a result.csv + for i in $(seq 1 $TRIES); do + RES=$(mysql -vvv -h127.1 -P9030 -uroot hits -e "${query}" | perl -nle 'print $1 if /\((\d+\.\d+)+ sec\)/' || :) + + echo -n "$RES" | tee -a result.csv + [[ "$i" != "$TRIES" ]] && echo -n "," | tee -a result.csv + done + echo "" | tee -a result.csv + + QUERY_NUM=$((QUERY_NUM + 1)) +done