ClickHouse 26.1 版本发布说明
本文字数:11903;估计阅读时间:30分钟
作者:ClickHouse Team
发布概要
ClickHouse 26.1 版本带来了 25 项新特性 🧤、43 项性能优化 🛷,以及 176 个 bug 修复 ⛄
Aleksandr Tolkachev, Alex Soffronow Pagonidis, Alexey Bakharew, Andrew Slabko, Arsen Muk, Binnn-MX, Cole Smith, Daniel Muino, Fabian Ponce, Govind R Nair, Hechem Selmi, JIaQi, Jack Danger, JasonLi-cn, Jeremy Aguilon, Josh Carp, Julio Jordan, Karun, Karun Anantharaman, Kirill Kopnev, LeeChaeRok, MakarDev, Matt Klein, Michael Jarrett, Paresh Joshi, Revertionist, Sam Kaessner, Seva Potapov, Shaurya Mohan, Sümer Cip, Xuewei Wang, Yonatan-Dolan, alsugiliazova, gayanMatch, ggmolly, htuall, ita004, jetsetbrand, lijingxuan92, matanper, mostafa, pranavt84, punithns97, rainac1, speeedmaster, withlin
由 Sema Checherinda 贡献
为什么仅有批处理还不够
用于幂等插入的自动去重
用于异步插入的去重
依赖型物化视图的问题(在 26.1 之前)
示例:带有物化视图的去重异步插入
CREATE TABLE events(value UInt64)ENGINE = MergeTreeORDER BY value;
CREATE TABLE events_mv_target(sum UInt64)ENGINE = SummingMergeTreeORDER BY tuple();
CREATE MATERIALIZED VIEW events_mvTO events_mv_targetASSELECTsum(value) AS sumFROM events;
图 1: 带有依赖物化视图的初始异步插入
图 2: 带有依赖物化视图的重试
由 Amos Bird 贡献
CREATE OR REPLACE TABLE uk.uk_price_paid_with_proj(price UInt32,...PROJECTION by_time (SELECT _part_offset ORDER BY date),PROJECTION by_town (SELECT _part_offset ORDER BY town))ENGINE = MergeTreeORDER BY (postcode1, postcode2, addr1, addr2);
CREATE OR REPLACE TABLE uk.uk_price_paid_with_proj(price UInt32,...PROJECTION by_time INDEX date TYPE basic,PROJECTION by_town INDEX town TYPE basic)ENGINE = MergeTreeORDER BY (postcode1, postcode2, addr1, addr2);
由 Nihal Z. Miaji 贡献
新的系统表:zookeeper_info 由 Smita Kulkarni 贡献
SELECT *FROM system.zookeeper_info;
Row 1:──────zookeeper_cluster_name: zookeeperhost: localhostport: 9181index: 0is_connected: 1is_readonly: 0version: v26.2.1.90-testing-a44e1...avg_latency: 1max_latency: 100min_latency: 0packets_received: 4598packets_sent: 4738
Keeper 的 Web UI 与 HTTP 接口 由 Alexander Tolkachev 和 Artem Brustovetskii 贡献
system.parts 中的文件信息 由 Gayan Match 贡献
SELECT name, rows, marks, bytes, filesFROM system.partsWHERE database = 'default' AND table = 'github_events';
┌─name─────────────┬───────rows─┬─marks──┬──────────bytes─┬─files─┐│ all_0_0_0_288 │ 4430017383 │ 576807 │ 332974330897 │ 145 ││ all_1_1_0_288 │ 853559 │ 108 │ 77871986 │ 196 ││ all_2_2_0_288 │ 22523075 │ 2783 │ 1618742341 │ 196 ││ all_3_3_0_288 │ 855252 │ 107 │ 42151604 │ 202 ││ all_4_4_0_288 │ 612539497 │ 75810 │ 45082755883 │ 188 ││ all_5_5_0_288 │ 1082739624 │ 138264 │ 123406140554 │ 145 ││ all_6_6_0_288 │ 1546160205 │ 191296 │ 101227190998 │ 198 ││ all_7_2820_6_288 │ 2225987644 │ 278473 │ 157837202094 │ 192 │└───────────────────┴────────────┴────────┴────────────────┴───────┘
mergeTreeAnalyzeIndexes 表函数 由 Azat Khuzhin 贡献
SELECT *FROM mergeTreeAnalyzeIndexes(default, github_events, repo_name = 'ClickHouse/ClickHouse');
SELECT * FROM mergeTreeAnalyzeIndexes(default, github_events, repo_name = 'ClickHouse/ClickHouse')
表(ASCII):
┌─part_name──────────┬─ranges──────────────────────────────────────────────────┐│ all_0_0_0_288 │ [(101,102),(2149,2150),(6938,6940),(81644,... ││ all_1_1_0_288 │ [(0,1),(10,11),(12,15),(18,19),(20,22),(27... ││ all_2_2_0_288 │ [(0,1),(8,9),(32,33),(295,296),(300,301),(... ││ all_3_3_0_288 │ [(0,2),(9,13),(15,18),(21,22),(26,27),(98,... ││ all_4_4_0_288 │ [(21,22),(309,310),(1041,1043),(10038,1003... ││ all_5_5_0_288 │ [(55,56),(854,855),(2423,2424),(22336,2233... ││ all_6_6_0_288 │ [(64,65),(893,894),(2721,2723),(24902,2490... ││ all_7_2820_6_288 │ [(12,13),(207,208),(2688,2691),(32469,3247... │└────────────────────┴─────────────────────────────────────────────────────────┘
由 Xuewei Wang 贡献
SELECT reverseBySeparator('benchmark.clickhouse.com', '.') AS x┌─x────────────────────────┐│ com.clickhouse.benchmark │└──────────────────────────┘
SELECT arrayStringConcat(reverse(splitByChar('.','benchmark.clickhouse.com')),'.') AS x;
由 Bharat Nallan 贡献
SELECT length('ClickHouse'::Variant(String, UInt32));Received exception:Code: 43. DB::Exception: Illegal type Variant(String, UInt32) of argument of functionlength: InscopeSELECTlength(CAST('ClickHouse', 'Variant(String, UInt32)')). (ILLEGAL_TYPE_OF_ARGUMENT)
┌─length(CAST(⋯ UInt32)'))─┐│ 10 │└──────────────────────────┘
CREATE TABLE test (v Variant(UInt32, String, Array(String)));INSERT INTO test VALUES('ClickHouse'),(42),(10),(['We', 'Love', 'Clickhouse']);
SELECT *FROM testWHERE v > 10;
Received exception:Code: 43. DB::Exception: Illegal types of arguments (`Variant(Array(String), String, UInt32)`, `UInt8`) of function `greater`: In scope SELECT * FROM test WHERE v > 10. (ILLEGAL_TYPE_OF_ARGUMENT)
┌─v──┐│ 42 │└────┘
CREATE TABLE hackernews(`id` Int64,`deleted` Int64,`type` String,`by` String,`time` DateTime64(9),`text` String,`dead` Int64,`parent` Int64,`poll` Int64,`kids` Array(Int64),`url` String,`score` Int64,`title` String,`parts` Array(Int64),`descendants` Int64,INDEX inv_idx(text) TYPE text(tokenizer = 'splitByNonAlpha')GRANULARITY 128)ENGINE = MergeTreeORDER BY time;
CREATE TABLE hackernews_sparseGrams(`id` Int64,`deleted` Int64,`type` String,`by` String,`time` DateTime64(9),`text` String,`dead` Int64,`parent` Int64,`poll` Int64,`kids` Array(Int64),`url` String,`score` Int64,`title` String,`parts` Array(Int64),`descendants` Int64,INDEX inv_idx(text) TYPE text(tokenizer = sparseGrams(3, 20, 5),preprocessor = lower(text))GRANULARITY 128)ENGINE = MergeTreeORDER BY time;
28737557 rows in set. Elapsed: 120.358 sec. Processed 28.74 million rows, 4.98 GB (238.77 thousand rows/s., 41.36 MB/s.)Peak memory usage: 1.36 GiB.
28737557 rows in set. Elapsed: 1162.247 sec. Processed 28.74 million rows, 4.98 GB (24.73 thousand rows/s., 4.28 MB/s.)Peak memory usage: 4.37 GiB.
SELECT table,formatReadableSize(sum(data_compressed_bytes)) AS data,formatReadableSize(sum(secondary_indices_compressed_bytes)) AS secondaryIndicesFROM system.partsWHERE table LIKE 'hackernews%'GROUP BY ALL;
┌─table──────────────────┬─data─────┬─secondaryIndices─┐│ hackernews │ 6.77 GiB │ 2.00 GiB ││ hackernews_sparseGrams │ 6.77 GiB │ 16.19 GiB │└────────────────────────┴──────────┴──────────────────┘
SELECT by, count()FROM hackernewsWHERE text LIKE '%relational database%'GROUP BY ALLORDER BY count() DESCLIMIT 10;
10 rows in set. Elapsed: 1.482 sec. Processed 28.74 million rows, 9.77 GB (19.39 million rows/s., 6.59 GB/s.)Peak memory usage: 169.01 MiB.10 rows in set. Elapsed: 1.454 sec. Processed 28.74 million rows, 9.77 GB (19.76 million rows/s., 6.72 GB/s.)Peak memory usage: 168.84 MiB.10 rows in set. Elapsed: 1.392 sec. Processed 28.64 million rows, 9.74 GB (20.58 million rows/s., 7.00 GB/s.)Peak memory usage: 169.69 MiB.
CREATE TABLE tab(key UInt64,val Array(String),INDEX idx(val) TYPE text(tokenizer = 'splitByNonAlpha', preprocessor = lower(val)));
SELECT count() FROM tabWHERE hasAllTokens(val, 'clickhouse');
由 Raufs Dunamalijevs 贡献
由 Grigory Pervakov 贡献
/END/
试用阿里云 ClickHouse企业版
轻松节省30%云资源成本?阿里云数据库ClickHouse 云原生架构全新升级,首次购买ClickHouse企业版计算和存储资源组合,首月消费不超过99.58元(包含最大16CCU+450G OSS用量)了解详情:https://t.aliyun.com/Kz5Z0q9G
征稿启示
面向社区长期正文,文章内容包括但不限于关于 ClickHouse 的技术研究、项目实践和创新做法等。建议行文风格干货输出&图文并茂。质量合格的文章将会发布在本公众号,优秀者也有机会推荐到 ClickHouse 官网。请将文章稿件的 WORD 版本发邮件至:[email protected]