Added instruction

This commit is contained in:
Alexey Milovidov 2020-07-29 00:37:00 +03:00
parent 023540f238
commit 10346964ed

View File

@ -1,231 +1,331 @@
clickhouse-client --query "SHOW CREATE TABLE hits_100m" --format TSVRaw | tr '`' '"' | sed -r -e 's/U?Int64/BIGINT/; s/U?Int32/INTEGER/; s/U?Int16/SMALLINT/; s/U?Int8/TINYINT/; s/DateTime/TIMESTAMP ENCODING FIXED(32)/; s/Date/DATE ENCODING DAYS(16)/; s/FixedString\(2\)/TEXT ENCODING DICT(16)/; s/FixedString\(3\)/TEXT ENCODING DICT/; s/FixedString\(\d+\)/TEXT ENCODING DICT/; s/String/TEXT ENCODING DICT/;' # Instruction to run benchmark for OmniSci on web-analytics dataset
clickhouse-client --query "SHOW CREATE TABLE hits_100m" --format TSVRaw | tr '`' '"' | sed -r -e 's/"(\w+)" U?Int([0-9]+)/toInt\2(\1)/; s/"(\w+)" (Fixed)?String(\([0-9]+\))?/toValidUTF8(toString(\1))/; s/"(\w+)" \w+/\1/' OmniSci (former name "MapD") is open-source (open-core) in-memory analytical DBMS with support for GPU processing.
It can run on CPU without GPU as well. It can show competitive performance on simple queries (like - simple aggregation on a single column).
# How to install
https://docs.omnisci.com/installation-and-configuration/installation/installing-on-ubuntu
# Caveats
- Dataset (at least needed columns) must fit in memory.
- It does not support data compression (only dictionary encoding for strings).
- First query execution is very slow because uncompressed data is read from disk.
- It does not support index for quick range queries.
- It does not support NOT NULL for data types.
- It does not support BLOB.
- No support for UNSIGNED data type (it's Ok according to SQL standard).
- Lack of string processing functions.
- Strings are limited to 32767 bytes.
- GROUP BY on text data type is supported only if it has dictionary encoding.
`Exception: Cannot group by string columns which are not dictionary encoded`
- Some aggregate functions are not supported for strings at all.
`Aggregate on TEXT is not supported yet.`
- Sometimes I hit a bug when query is run in infinite loop and does not finish (after retry it's finished successfully).
- One query executed in hours even with retries.
- Sorting is slow and disabled with default settings for large resultsets.
`Exception: Sorting the result would be too slow`
`Cast from dictionary-encoded string to none-encoded would be slow`
To enable sorting of large resultsets, see:
https://stackoverflow.com/questions/62977734/omnissci-sorting-the-result-would-be-too-slow
The list of known issues is here:
https://github.com/omnisci/omniscidb/issues?q=is%3Aissue+author%3Aalexey-milovidov
# How to prepare data
Download the 100 million rows dataset from here and insert into ClickHouse:
https://clickhouse.tech/docs/en/getting-started/example-datasets/metrica/
Convert the CREATE TABLE query:
```
clickhouse-client --query "SHOW CREATE TABLE hits_100m" --format TSVRaw |
tr '`' '"' |
sed -r -e '
s/U?Int64/BIGINT/;
s/U?Int32/INTEGER/;
s/U?Int16/SMALLINT/;
s/U?Int8/TINYINT/;
s/DateTime/TIMESTAMP ENCODING FIXED(32)/;
s/ Date/ DATE ENCODING DAYS(16)/;
s/FixedString\(2\)/TEXT ENCODING DICT(16)/;
s/FixedString\(3\)/TEXT ENCODING DICT/;
s/FixedString\(\d+\)/TEXT ENCODING DICT/;
s/String/TEXT ENCODING DICT/;'
```
And cut `ENGINE` part.
The resulting CREATE TABLE query:
```
CREATE TABLE hits CREATE TABLE hits
( (
"WatchID" BIGINT, "WatchID" BIGINT,
"JavaEnable" TINYINT, "JavaEnable" TINYINT,
"Title" TEXT ENCODING DICT, "Title" TEXT ENCODING DICT,
"GoodEvent" SMALLINT, "GoodEvent" SMALLINT,
"EventTime" TIMESTAMP ENCODING FIXED(32), "EventTime" TIMESTAMP ENCODING FIXED(32),
"EventDate" ENCODING DAYS(16) Date, "EventDate" ENCODING DAYS(16) Date,
"CounterID" INTEGER, "CounterID" INTEGER,
"ClientIP" INTEGER, "ClientIP" INTEGER,
"RegionID" INTEGER, "RegionID" INTEGER,
"UserID" BIGINT, "UserID" BIGINT,
"CounterClass" TINYINT, "CounterClass" TINYINT,
"OS" TINYINT, "OS" TINYINT,
"UserAgent" TINYINT, "UserAgent" TINYINT,
"URL" TEXT ENCODING DICT, "URL" TEXT ENCODING DICT,
"Referer" TEXT ENCODING DICT, "Referer" TEXT ENCODING DICT,
"Refresh" TINYINT, "Refresh" TINYINT,
"RefererCategoryID" SMALLINT, "RefererCategoryID" SMALLINT,
"RefererRegionID" INTEGER, "RefererRegionID" INTEGER,
"URLCategoryID" SMALLINT, "URLCategoryID" SMALLINT,
"URLRegionID" INTEGER, "URLRegionID" INTEGER,
"ResolutionWidth" SMALLINT, "ResolutionWidth" SMALLINT,
"ResolutionHeight" SMALLINT, "ResolutionHeight" SMALLINT,
"ResolutionDepth" TINYINT, "ResolutionDepth" TINYINT,
"FlashMajor" TINYINT, "FlashMajor" TINYINT,
"FlashMinor" TINYINT, "FlashMinor" TINYINT,
"FlashMinor2" TEXT ENCODING DICT, "FlashMinor2" TEXT ENCODING DICT,
"NetMajor" TINYINT, "NetMajor" TINYINT,
"NetMinor" TINYINT, "NetMinor" TINYINT,
"UserAgentMajor" SMALLINT, "UserAgentMajor" SMALLINT,
"UserAgentMinor" TEXT ENCODING DICT(16), "UserAgentMinor" TEXT ENCODING DICT(16),
"CookieEnable" TINYINT, "CookieEnable" TINYINT,
"JavascriptEnable" TINYINT, "JavascriptEnable" TINYINT,
"IsMobile" TINYINT, "IsMobile" TINYINT,
"MobilePhone" TINYINT, "MobilePhone" TINYINT,
"MobilePhoneModel" TEXT ENCODING DICT, "MobilePhoneModel" TEXT ENCODING DICT,
"Params" TEXT ENCODING DICT, "Params" TEXT ENCODING DICT,
"IPNetworkID" INTEGER, "IPNetworkID" INTEGER,
"TraficSourceID" TINYINT, "TraficSourceID" TINYINT,
"SearchEngineID" SMALLINT, "SearchEngineID" SMALLINT,
"SearchPhrase" TEXT ENCODING DICT, "SearchPhrase" TEXT ENCODING DICT,
"AdvEngineID" TINYINT, "AdvEngineID" TINYINT,
"IsArtifical" TINYINT, "IsArtifical" TINYINT,
"WindowClientWidth" SMALLINT, "WindowClientWidth" SMALLINT,
"WindowClientHeight" SMALLINT, "WindowClientHeight" SMALLINT,
"ClientTimeZone" SMALLINT, "ClientTimeZone" SMALLINT,
"ClientEventTime" TIMESTAMP ENCODING FIXED(32), "ClientEventTime" TIMESTAMP ENCODING FIXED(32),
"SilverlightVersion1" TINYINT, "SilverlightVersion1" TINYINT,
"SilverlightVersion2" TINYINT, "SilverlightVersion2" TINYINT,
"SilverlightVersion3" INTEGER, "SilverlightVersion3" INTEGER,
"SilverlightVersion4" SMALLINT, "SilverlightVersion4" SMALLINT,
"PageCharset" TEXT ENCODING DICT, "PageCharset" TEXT ENCODING DICT,
"CodeVersion" INTEGER, "CodeVersion" INTEGER,
"IsLink" TINYINT, "IsLink" TINYINT,
"IsDownload" TINYINT, "IsDownload" TINYINT,
"IsNotBounce" TINYINT, "IsNotBounce" TINYINT,
"FUniqID" BIGINT, "FUniqID" BIGINT,
"OriginalURL" TEXT ENCODING DICT, "OriginalURL" TEXT ENCODING DICT,
"HID" INTEGER, "HID" INTEGER,
"IsOldCounter" TINYINT, "IsOldCounter" TINYINT,
"IsEvent" TINYINT, "IsEvent" TINYINT,
"IsParameter" TINYINT, "IsParameter" TINYINT,
"DontCountHits" TINYINT, "DontCountHits" TINYINT,
"WithHash" TINYINT, "WithHash" TINYINT,
"HitColor" TEXT ENCODING DICT(8), "HitColor" TEXT ENCODING DICT(8),
"LocalEventTime" TIMESTAMP ENCODING FIXED(32), "LocalEventTime" TIMESTAMP ENCODING FIXED(32),
"Age" TINYINT, "Age" TINYINT,
"Sex" TINYINT, "Sex" TINYINT,
"Income" TINYINT, "Income" TINYINT,
"Interests" SMALLINT, "Interests" SMALLINT,
"Robotness" TINYINT, "Robotness" TINYINT,
"RemoteIP" INTEGER, "RemoteIP" INTEGER,
"WindowName" INTEGER, "WindowName" INTEGER,
"OpenerName" INTEGER, "OpenerName" INTEGER,
"HistoryLength" SMALLINT, "HistoryLength" SMALLINT,
"BrowserLanguage" TEXT ENCODING DICT(16), "BrowserLanguage" TEXT ENCODING DICT(16),
"BrowserCountry" TEXT ENCODING DICT(16), "BrowserCountry" TEXT ENCODING DICT(16),
"SocialNetwork" TEXT ENCODING DICT, "SocialNetwork" TEXT ENCODING DICT,
"SocialAction" TEXT ENCODING DICT, "SocialAction" TEXT ENCODING DICT,
"HTTPError" SMALLINT, "HTTPError" SMALLINT,
"SendTiming" INTEGER, "SendTiming" INTEGER,
"DNSTiming" INTEGER, "DNSTiming" INTEGER,
"ConnectTiming" INTEGER, "ConnectTiming" INTEGER,
"ResponseStartTiming" INTEGER, "ResponseStartTiming" INTEGER,
"ResponseEndTiming" INTEGER, "ResponseEndTiming" INTEGER,
"FetchTiming" INTEGER, "FetchTiming" INTEGER,
"SocialSourceNetworkID" TINYINT, "SocialSourceNetworkID" TINYINT,
"SocialSourcePage" TEXT ENCODING DICT, "SocialSourcePage" TEXT ENCODING DICT,
"ParamPrice" BIGINT, "ParamPrice" BIGINT,
"ParamOrderID" TEXT ENCODING DICT, "ParamOrderID" TEXT ENCODING DICT,
"ParamCurrency" TEXT ENCODING DICT, "ParamCurrency" TEXT ENCODING DICT,
"ParamCurrencyID" SMALLINT, "ParamCurrencyID" SMALLINT,
"OpenstatServiceName" TEXT ENCODING DICT, "OpenstatServiceName" TEXT ENCODING DICT,
"OpenstatCampaignID" TEXT ENCODING DICT, "OpenstatCampaignID" TEXT ENCODING DICT,
"OpenstatAdID" TEXT ENCODING DICT, "OpenstatAdID" TEXT ENCODING DICT,
"OpenstatSourceID" TEXT ENCODING DICT, "OpenstatSourceID" TEXT ENCODING DICT,
"UTMSource" TEXT ENCODING DICT, "UTMSource" TEXT ENCODING DICT,
"UTMMedium" TEXT ENCODING DICT, "UTMMedium" TEXT ENCODING DICT,
"UTMCampaign" TEXT ENCODING DICT, "UTMCampaign" TEXT ENCODING DICT,
"UTMContent" TEXT ENCODING DICT, "UTMContent" TEXT ENCODING DICT,
"UTMTerm" TEXT ENCODING DICT, "UTMTerm" TEXT ENCODING DICT,
"FromTag" TEXT ENCODING DICT, "FromTag" TEXT ENCODING DICT,
"HasGCLID" TINYINT, "HasGCLID" TINYINT,
"RefererHash" BIGINT, "RefererHash" BIGINT,
"URLHash" BIGINT, "URLHash" BIGINT,
"CLID" INTEGER "CLID" INTEGER
); );
```
SELECT Convert the dataset, prepare the list of fields for SELECT:
toInt64(WatchID),
toInt8(JavaEnable), ```
toValidUTF8(toString(Title)), clickhouse-client --query "SHOW CREATE TABLE hits_100m" --format TSVRaw |
toInt16(GoodEvent), tr '`' '"' |
EventTime, sed -r -e '
EventDate, s/"(\w+)" U?Int([0-9]+)/toInt\2(\1)/;
toInt32(CounterID), s/"(\w+)" (Fixed)?String(\([0-9]+\))?/toValidUTF8(toString(\1))/;
toInt32(ClientIP), s/"(\w+)" \w+/\1/'
toInt32(RegionID), ```
toInt64(UserID),
toInt8(CounterClass), The resulting SELECT query for data preparation:
toInt8(OS),
toInt8(UserAgent), ```
toValidUTF8(toString(URL)), SELECT
toValidUTF8(toString(Referer)), toInt64(WatchID),
toInt8(Refresh), toInt8(JavaEnable),
toInt16(RefererCategoryID), toValidUTF8(toString(Title)),
toInt32(RefererRegionID), toInt16(GoodEvent),
toInt16(URLCategoryID), EventTime,
toInt32(URLRegionID), EventDate,
toInt16(ResolutionWidth), toInt32(CounterID),
toInt16(ResolutionHeight), toInt32(ClientIP),
toInt8(ResolutionDepth), toInt32(RegionID),
toInt8(FlashMajor), toInt64(UserID),
toInt8(FlashMinor), toInt8(CounterClass),
toValidUTF8(toString(FlashMinor2)), toInt8(OS),
toInt8(NetMajor), toInt8(UserAgent),
toInt8(NetMinor), toValidUTF8(toString(URL)),
toInt16(UserAgentMajor), toValidUTF8(toString(Referer)),
toValidUTF8(toString(UserAgentMinor)), toInt8(Refresh),
toInt8(CookieEnable), toInt16(RefererCategoryID),
toInt8(JavascriptEnable), toInt32(RefererRegionID),
toInt8(IsMobile), toInt16(URLCategoryID),
toInt8(MobilePhone), toInt32(URLRegionID),
toValidUTF8(toString(MobilePhoneModel)), toInt16(ResolutionWidth),
toValidUTF8(toString(Params)), toInt16(ResolutionHeight),
toInt32(IPNetworkID), toInt8(ResolutionDepth),
toInt8(TraficSourceID), toInt8(FlashMajor),
toInt16(SearchEngineID), toInt8(FlashMinor),
toValidUTF8(toString(SearchPhrase)), toValidUTF8(toString(FlashMinor2)),
toInt8(AdvEngineID), toInt8(NetMajor),
toInt8(IsArtifical), toInt8(NetMinor),
toInt16(WindowClientWidth), toInt16(UserAgentMajor),
toInt16(WindowClientHeight), toValidUTF8(toString(UserAgentMinor)),
toInt16(ClientTimeZone), toInt8(CookieEnable),
ClientEventTime, toInt8(JavascriptEnable),
toInt8(SilverlightVersion1), toInt8(IsMobile),
toInt8(SilverlightVersion2), toInt8(MobilePhone),
toInt32(SilverlightVersion3), toValidUTF8(toString(MobilePhoneModel)),
toInt16(SilverlightVersion4), toValidUTF8(toString(Params)),
toValidUTF8(toString(PageCharset)), toInt32(IPNetworkID),
toInt32(CodeVersion), toInt8(TraficSourceID),
toInt8(IsLink), toInt16(SearchEngineID),
toInt8(IsDownload), toValidUTF8(toString(SearchPhrase)),
toInt8(IsNotBounce), toInt8(AdvEngineID),
toInt64(FUniqID), toInt8(IsArtifical),
toValidUTF8(toString(OriginalURL)), toInt16(WindowClientWidth),
toInt32(HID), toInt16(WindowClientHeight),
toInt8(IsOldCounter), toInt16(ClientTimeZone),
toInt8(IsEvent), ClientEventTime,
toInt8(IsParameter), toInt8(SilverlightVersion1),
toInt8(DontCountHits), toInt8(SilverlightVersion2),
toInt8(WithHash), toInt32(SilverlightVersion3),
toValidUTF8(toString(HitColor)), toInt16(SilverlightVersion4),
LocalEventTime, toValidUTF8(toString(PageCharset)),
toInt8(Age), toInt32(CodeVersion),
toInt8(Sex), toInt8(IsLink),
toInt8(Income), toInt8(IsDownload),
toInt16(Interests), toInt8(IsNotBounce),
toInt8(Robotness), toInt64(FUniqID),
toInt32(RemoteIP), toValidUTF8(toString(OriginalURL)),
toInt32(WindowName), toInt32(HID),
toInt32(OpenerName), toInt8(IsOldCounter),
toInt16(HistoryLength), toInt8(IsEvent),
toValidUTF8(toString(BrowserLanguage)), toInt8(IsParameter),
toValidUTF8(toString(BrowserCountry)), toInt8(DontCountHits),
toValidUTF8(toString(SocialNetwork)), toInt8(WithHash),
toValidUTF8(toString(SocialAction)), toValidUTF8(toString(HitColor)),
toInt16(HTTPError), LocalEventTime,
toInt32(SendTiming), toInt8(Age),
toInt32(DNSTiming), toInt8(Sex),
toInt32(ConnectTiming), toInt8(Income),
toInt32(ResponseStartTiming), toInt16(Interests),
toInt32(ResponseEndTiming), toInt8(Robotness),
toInt32(FetchTiming), toInt32(RemoteIP),
toInt8(SocialSourceNetworkID), toInt32(WindowName),
toValidUTF8(toString(SocialSourcePage)), toInt32(OpenerName),
toInt64(ParamPrice), toInt16(HistoryLength),
toValidUTF8(toString(ParamOrderID)), toValidUTF8(toString(BrowserLanguage)),
toValidUTF8(toString(ParamCurrency)), toValidUTF8(toString(BrowserCountry)),
toInt16(ParamCurrencyID), toValidUTF8(toString(SocialNetwork)),
toValidUTF8(toString(OpenstatServiceName)), toValidUTF8(toString(SocialAction)),
toValidUTF8(toString(OpenstatCampaignID)), toInt16(HTTPError),
toValidUTF8(toString(OpenstatAdID)), toInt32(SendTiming),
toValidUTF8(toString(OpenstatSourceID)), toInt32(DNSTiming),
toValidUTF8(toString(UTMSource)), toInt32(ConnectTiming),
toValidUTF8(toString(UTMMedium)), toInt32(ResponseStartTiming),
toValidUTF8(toString(UTMCampaign)), toInt32(ResponseEndTiming),
toValidUTF8(toString(UTMContent)), toInt32(FetchTiming),
toValidUTF8(toString(UTMTerm)), toInt8(SocialSourceNetworkID),
toValidUTF8(toString(FromTag)), toValidUTF8(toString(SocialSourcePage)),
toInt8(HasGCLID), toInt64(ParamPrice),
toInt64(RefererHash), toValidUTF8(toString(ParamOrderID)),
toInt64(URLHash), toValidUTF8(toString(ParamCurrency)),
toInt16(ParamCurrencyID),
toValidUTF8(toString(OpenstatServiceName)),
toValidUTF8(toString(OpenstatCampaignID)),
toValidUTF8(toString(OpenstatAdID)),
toValidUTF8(toString(OpenstatSourceID)),
toValidUTF8(toString(UTMSource)),
toValidUTF8(toString(UTMMedium)),
toValidUTF8(toString(UTMCampaign)),
toValidUTF8(toString(UTMContent)),
toValidUTF8(toString(UTMTerm)),
toValidUTF8(toString(FromTag)),
toInt8(HasGCLID),
toInt64(RefererHash),
toInt64(URLHash),
toInt32(CLID) toInt32(CLID)
FROM hits_100m_obfuscated FROM hits_100m_obfuscated
INTO OUTFILE '/home/milovidov/example_datasets/hits_100m_obfuscated.csv' INTO OUTFILE '/home/milovidov/example_datasets/hits_100m_obfuscated.csv'
FORMAT CSV; FORMAT CSV;
```
Upload data to OmniSci:
```
/opt/omnisci/bin/omnisql -t -p HyperInteractive
```
Run CREATE TABLE statement, then run:
```
COPY hits FROM '/home/milovidov/example_datasets/hits_100m_obfuscated.csv' WITH (HEADER = 'false'); COPY hits FROM '/home/milovidov/example_datasets/hits_100m_obfuscated.csv' WITH (HEADER = 'false');
```
Data loading took
```
336639 ms 336639 ms
```
on a server (Linux Ubuntu, Xeon E5-2560v2, 32 logical CPU, 128 GiB RAM, 8xHDD RAID-5, 40 TB).
Run benchmark:
```
./benchmark.sh ./benchmark.sh
```
grep -oP 'Total time: \d+' log.txt | grep -oP '\d+' | awk '{ if (i % 3 == 0) { a = $1 } else if (i % 3 == 1) { b = $1 } else if (i % 3 == 2) { c = $1; print "[" a / 1000 ", " b / 1000 ", " c / 1000 "]," }; ++i; }' Prepare the result to paste into JSON:
```
grep -oP 'Total time: \d+' log.txt |
grep -oP '\d+' |
awk '{
if (i % 3 == 0) { a = $1 }
else if (i % 3 == 1) { b = $1 }
else if (i % 3 == 2) { c = $1; print "[" a / 1000 ", " b / 1000 ", " c / 1000 "]," };
++i; }'
```
And fill out `[null, null, null]` for missing runs.