<div id="content_views" class="markdown_views prism-atom-one-dark">
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<path stroke-linecap="round" d="M5,0 0,2.5 5,5z" id="raphael-marker-block" style="-webkit-tap-highlight-color: rgba(0, 0, 0, 0);"></path>
</svg>
<h1><a name="t0"></a><a id="ClickHouse_vs_StarRocks__0"></a><a href="https://so.csdn.net/so/search?q=ClickHouse&spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{"spm":"1001.2101.3001.7020","dest":"https://so.csdn.net/so/search?q=ClickHouse&spm=1001.2101.3001.7020"}" data-tit="ClickHouse" data-pretit="clickhouse">ClickHouse</a> vs StarRocks 选型对比</h1>
<h2><a name="t1"></a><a id="_DBMS__2"></a>面向列存的 DBMS 新的选择</h2>
<p><a href="https://so.csdn.net/so/search?q=Hadoop&spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{"spm":"1001.2101.3001.7020","dest":"https://so.csdn.net/so/search?q=Hadoop&spm=1001.2101.3001.7020"}" data-tit="Hadoop" data-pretit="hadoop">Hadoop</a> 从诞生已经十三年了,Hadoop 的供应商争先恐后的为 Hadoop 贡献各种开源插件,发明各种的解决方案技术栈,一方面确实帮助很多用户解决了问题,但另一方面因为繁杂的技术栈与高昂的维护成本,Hadoop 也渐渐地失去了原本属于他的市场。对于用户来说,一套高性能,简单化,可扩展的数据库产品能够帮助他们解决业务痛点问题。越来越多的人将目光锁定在列存的分布式数据库上。</p>
<h3><a name="t2"></a><a id="ClickHouse__4"></a>ClickHouse 简介</h3>
<p>ClickHouse 是由俄罗斯的第一大搜索引擎 Yandex 公司开源的列存数据库。令人惊喜的是,ClickHouse 相较于很多商业 MPP 数据库,比如 Vertica,InfiniDB 有着极大的性能提升。除了 Yandex 以外,越来越多的公司开始尝试使用 ClickHouse 等列存数据库。对于一般的分析业务,结构性较强且数据变更不频繁,可以考虑将需要进行关联的表打平成宽表,放入 ClickHouse 中。<br> 相比传统的大数据解决方案,ClickHouse 有以下的优点:</p>
<ul><li>配置丰富,只依赖与 Zookeeper</li><li>线性可扩展性,可以通过添加服务器扩展集群</li><li>容错性高,不同分片间采用异步多主复制</li><li>单表性能极佳,采用向量计算,支持采样和近似计算等优化手段</li><li>功能强大支持多种表引擎</li></ul>
<h3><a name="t3"></a><a id="StarRocks__13"></a>StarRocks 简介</h3>
<p>StarRocks 是一款极速全场景 MPP 企业级数据库产品,具备水平在线扩缩容,金融级高可用,兼容 MySQL 协议和 MySQL 生态,提供全面向量化引擎与多种数据源联邦查询等重要特性。StarRocks 致力于在全场景 OLAP 业务上为用户提供统一的解决方案,适用于对性能,实时性,并发能力和灵活性有较高要求的各类应用场景。<br> 相比于传统的大数据解决方案,StarRocks 有以下优点:</p>
<ul><li>不依赖于大数据生态,同时外表的联邦查询可以兼容大数据生态</li><li>提供多种不同的模型,支持不同维度的数据建模</li><li>支持在线弹性扩缩容,可以自动负载均衡</li><li>支持高并发分析查询</li><li>实时性好,支持数据秒级写入</li><li>兼容 MySQL 5.7 协议和 MySQL 生态</li></ul>
<h1><a name="t4"></a><a id="StarRocks__ClickHouse__24"></a>StarRocks 与 ClickHouse 的功能对比</h1>
<p>StarRocks 与 ClickHouse 有很多相似之处,比如说两者都可以提供极致的性能,也都不依赖于 Hadoop 生态,底层存储分片都提供了主主的复制高可用机制。但功能、性能与使用场景上也有差异。ClickHouse 在更适用与大宽表的场景,TP 的数据通过 CDC 工具的,可以考虑在 Flink 中将需要关联的表打平,以大宽表的形式写入 ClickHouse。StarRocks 对于 join 的能力更强,可以建立星型或者雪花模型应对维度数据的变更。</p>
<h2><a name="t5"></a><a id="_vs__26"></a>大宽表 vs 星型模型</h2>
<h3><a name="t6"></a><a id="ClickHouse_join__27"></a>ClickHouse:通过拼宽表避免 join 操作</h3>
<p>不同于以点查为主的 TP 业务,在 AP 业务中,事实表和维度表的关联操作不可避免。ClickHouse 与 StarRocks 最大的区别就在于对于 join 的处理上。ClickHouse 虽然提供了 join 的语义,但使用上对大表关联的能力支撑较弱,复杂的关联查询经常会引起 OOM。一般我们可以考虑在 ETL 的过程中就将事实表与维度表打平成宽表,避免在 ClickHouse 中进行复杂的查询。<br> 目前有很多业务使用宽表来解决多远分析的问题,说明了宽表确有其独到之处:</p>
<ul><li>在 ETL 的过程中处理好宽表的字段,分析师无需关心底层的逻辑就可以实现数据的分析</li><li>宽表能够包含更多的业务数据,看起来更直观一些</li><li>宽表相当于单表查询,避免了多表之间的数据关联,性能更好<br> 但同时,宽表在灵活性上也带来了一些困扰:</li><li>宽表中的数据可能会因为 join 的过程中存在一对多的情况造成错误数据冗余</li><li>宽表的结构维护麻烦,遇到维度数据变更的情况需要重跑宽表</li><li>宽表需要根据业务预先定义,宽表可能无法满足临时新增的查询业务</li></ul>
<h3><a name="t7"></a><a id="StarRocks_37"></a>StarRocks:通过星型模型适应维度变更</h3>
<p>可以说,拼宽表的形式是以牺牲灵活性为代价,将 join 的操作前置,来加速业务的查询。但在一些灵活度要求较高的场景,比如订单的状态需要频繁改变,或者说业务人员的自助 BI 分析,宽表往往无法满足我们的需求。此时我们还需要使用更为灵活的星型或者雪花模型进行建模。对于星型/雪花模型的兼容度上,StarRocks 的支撑要比 ClickHouse 好很多。<br> <img src="https://img-blog.csdnimg.cn/ef0a990016a2463e8ad0b01458936efd.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"><br> 在 StarRocks 中提供了三种不同类型的 join:</p>
<ul><li>当小表与大表关联时,可以使用 boardcast join,小表会以广播的形式加载到不同节点的内存中</li><li>当大表与大表关联式,可以使用 shuffle join,两张表值相同的数据会 shuffle 到相同的机器上</li><li>为了避免 shuffle 带来的网络与 I/O 的开销,也可以在创建表示就将需要关联的数据存储在同一个 colocation group 中,使用 colocation join</li></ul>
<pre class="prettyprint"><code class="prism language-sql has-numbering" οnclick="mdcp.copyCode(event)" style="position: unset;"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> tbl <span class="token punctuation">(</span>k1 <span class="token keyword">int</span><span class="token punctuation">,</span> v1 <span class="token keyword">int</span> sum<span class="token punctuation">)</span>
<span class="token keyword">DISTRIBUTED</span> <span class="token keyword">BY</span> <span class="token keyword">HASH</span><span class="token punctuation">(</span>k1<span class="token punctuation">)</span>
BUCKETS <span class="token number">8</span>
PROPERTIES<span class="token punctuation">(</span>
<span class="token string">"colocate_with"</span> <span class="token operator">=</span> <span class="token string">"group1"</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<div class="hljs-button {2}" data-title="复制" data-report-click="{"spm":"1001.2101.3001.4259"}"></div></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
<p>目前大部分的 MPP 架构计算引擎,都采用基于规则的优化器(RBO)。为了更好的选择 join 的类型,StarRocks 提供了基于代价的优化器(CBO)。用户在开发业务 SQL 的时候,不需要考虑驱动表与被驱动表的顺序,也不需要考虑应该使用哪一种 join 的类型,CBO 会基于采集到的表的 metric,自动的进行查询重写,优化 join 的顺序与类型。</p>
<h2><a name="t8"></a><a id="_55"></a>高并发支撑</h2>
<h3><a name="t9"></a><a id="ClickHouse__56"></a>ClickHouse 对高并发的支撑</h3>
<p>为了更深维度的挖掘数据的价值,就需要引入更多的分析师从不同的维度进行数据勘察。更多的使用者同时也带来了更高的 QPS 要求。对于互联网,金融等行业,几万员工,几十万员工很常见,高峰时期并发量在几千也并不少见。随着互联网化和场景化的趋势,业务逐渐向以用户为中心转型,分析的重点也从原有的宏观分析变成了用户维度的细粒度分析。传统的 MPP 数据库由于所有的节点都要参与运算,所以一个集群的并发能力与一个节点的并发能力相差无几。如果一定要提高并发量,可以考虑增加副本数的方式,但同时也增加了 RPC 的交互,对性能和物理成本的影响巨大。<br> 在 ClickHouse 中,我们一般不建议做高并发的业务查询,对于三副本的集群,通常会将 QPS 控制在 100 以下。ClickHouse 对高并发的业务并不友好,即使一个查询,也会用服务器一半的 CPU 去查询。一般来说,没有什么有效的手段可以直接提高 ClickHouse 的并发量,只能考虑通过将结果集写入 MySQL 中增加查询的并发度。</p>
<h3><a name="t10"></a><a id="StarRocks__59"></a>StarRocks 对高并发的支撑</h3>
<p>相较于 ClickHouse,StarRocks 可以支撑数千用户同时进行分析查询,在部分场景下,高并发能力能够达到万级。StarRocks 在数据存储层,采用先分区再分桶的策略,增加了数据的指向性,利用前缀索引可以快读对数据进行过滤和查找,减少磁盘的 I/O 操作,提升查询性能。<br> <img src="https://img-blog.csdnimg.cn/52fbf65329a643e3a6a733a83b26e4bb.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"><br> 在建表的时候,分区分桶应该尽可能的覆盖到所带的查询语句,这样可以有效的利用分区分桶剪裁的功能,尽可能的减少数据的扫描量。此外,StarRocks 也提供了 MOLAP 库的预聚合能力。对于一些复杂的分析类查询,可以通过创建物化视图进行预先聚合,原有几十亿的基表,可以通过预聚合 RollUp 操作变成几百或者几千行的表,查询时延迟会有显著下降,并发也会有显著提升。</p>
<h2><a name="t11"></a><a id="_64"></a>数据的高频变更</h2>
<h3><a name="t12"></a><a id="ClickHouse__65"></a>ClickHouse 中的数据更新</h3>
<p>在 OLAP 数据库中,可变数据(Mutable data)通常是不受欢迎的。ClickHouse 也是如此。早期的版本中并不支持 UPDATE 和 DELETE 操作。在 1.15 版本后,Clickhouse 提供了 MUTATION 操作(通过 ALTER TABLE 语句)来实现数据的更新、删除,但这是一种“较重”的操作,它与标准 SQL 语法中的 UPDATE、DELETE 不同,是异步执行的,对于批量数据不频繁的更新或删除比较有用。除了 MUTATION 操作,Clickhouse 还可以通过 CollapsingMergeTree、VersionedCollapsingMergeTree、ReplacingMergeTree 结合具体业务数据结构来实现数据的更新、删除,这三种方式都通过 INSERT 语句插入最新的数据,新数据会“抵消”或“替换”掉老数据,但是“抵消”或“替换”都是发生在数据文件后台 Merge 时,也就是说,在 Merge 之前,新数据和老数据会同时存在。<br> 针对与不同的业务场景,ClickHouse 提供了不同的业务引擎来进行数据变更。<br> 对于离线业务,可以考虑增量和全量两种方案:<br> <strong>增量同步方案</strong>中,使用 ReplacingMergeTree 引擎,先用 Spark 将上游数据同步到 Hive,再由 Spark 消费 Hive 中的增量数据写入到 ClickHouse 中。由于只同步增量数据,对下游的压力较小。需要确保维度数据基本不变。<br> <strong>全量同步方</strong>案中,使用 MergeTree 引擎,通过 Spark 将上游数据定时同步到 Hive 中,truncate ClickHouse 中的表,随后使用 Spark 消费 Hive 近几天的数据一起写入到 ClickHouse 中。由于是全量数据导入,对下游压力较大,但无需考虑维度变化的问题。<br> 对于实时业务,可以采用 VersionedCollapsingMergeTree 和 ReplacingMergeTree 两种引擎:<br> <strong>使用 VersionedCollapsingMergeTree 引擎</strong>,先通过 Spark 将上游数据一次性同步到 ClickHouse 中,在通过 Kafka 消费增量数据,实时同步到 ClickHouse 中。但因为引入了 MQ,需要保证 exectly once 语义,实时和离线数据连接点存在无法折叠现象。<br> <strong>使用 ReplacingMergeTree 引擎</strong>替换 VersionedCollapsingMergeTree 引擎,先通过 Spark 将上游存量数据一次性同步到 ClickHouse 中,在通过 MQ 将实时数据同步到 ReplacingMergeTree 引擎中,相比 VersionedCollapsingMergeTree 要更简单,且离线和实时数据连接点不存在异常。但此种方案无法保重没有重复数据。</p>
<h3><a name="t13"></a><a id="StarRocks__74"></a>StarRocks 中的数据更新</h3>
<p>相较于 ClickHouse,StarRocks 对于数据更新的操作更加简单。<br> StarRocks 中提供了多种模型适配了更新操作,明细召回操作,聚合操作等业务需求。更新模型可以按照主键进行 UPDATE/DELETE 操作,通过存储和索引的优化可以在并发更新的同时高效的查询。在某些电商场景中,订单的状态需要频繁的更新,每天更新的订单量可能上亿。通过更新模型,可以很好的适配实时更新的需求。</p>
<div class="table-box"><table><thead><tr><th></th><th>特点</th><th>适用场景</th></tr></thead><tbody><tr><td>明细模型</td><td>用于保存和分析原始明细数据,以追加写为主要写入方式,数据写入后几乎无更新。</td><td>日志,操作记录,设备状态采样,时序类数据等</td></tr><tr><td>聚合模型</td><td>用于保存和分析汇总类(如:max、min、sum等)数据,不需要查询明细数据。数据导入后实时完成聚合,数据写入后几乎无更新。</td><td>按时间、地域、机构汇总数据等</td></tr><tr><td>Primary Key</td><td>模型 支持基于主键的更新,delete-and-insert,大批量导入时保证高性能查询。用于保存和分析需要更新的数据。</td><td>状态会发生变动的订单,设备状态等</td></tr><tr><td>Unique 模型</td><td>支持基于主键的更新,Merge On Read,更新频率比主键模型更高。用于保存和分析需要更新的数据。</td><td>状态会发生变动的订单,设备状态等</td></tr></tbody></table></div>
<p>StarRocks 1.19 版本之前,可以使用 Unique 模型进行按主键的更新操作,Unique 模型使用的是 Merge-on-Read 策略,即在数据入库的时候会给每一个批次导入数据分配一个版本号,同一主键的数据可能有多个版本号,在查询的时候 StarRocks 会先做 merge 操作,返回一个版本号最新的数据。<br> 自 StarRocks 1.19 版本之后发布了主键模型,能够通过主键进行更新和删除的操作,更友好的支持实时/频繁更新的需求。相较于 Unique 模型中 Merge-on-Read 的模式,主键模型中使用的是 Delete-and-Insert 的更新策略,性能会有三倍左右的提升。对于前端的 TP 库通过 CDC 实时同步到 StarRocks 的场景,建议使用主键模型。</p>
<h2><a name="t14"></a><a id="_88"></a>集群的维护</h2>
<p>相比于单实例的数据库,任何一款<a href="https://so.csdn.net/so/search?q=%E5%88%86%E5%B8%83%E5%BC%8F&spm=1001.2101.3001.7020" target="_blank" class="hl hl-1" data-report-click="{"spm":"1001.2101.3001.7020","dest":"https://so.csdn.net/so/search?q=%E5%88%86%E5%B8%83%E5%BC%8F&spm=1001.2101.3001.7020"}" data-tit="分布式" data-pretit="分布式">分布式</a>数据库维护的成本都要成倍的增长。一方面是节点增多,发生故障的几率变高。对于这种情况,我们需要一套良好的自动 failover 机制。另一方便随着数据量的增长,要能做到在线弹性扩缩容,保证集群的稳定性与可用性。<br> ###ClickHouse 中的节点扩容与重分布<br> 与一般的分布式数据库或者 Hadoop 生态不同,HDFS 可以根据集群节点的增减自动的通过 balance 来调节数据均衡。但是 ClickHouse 集群不能自动感知集群拓扑的变化,所以就不能自动 balance 数据。当集群数据较大时,新增集群节点可能会给数据负载均衡带来极大的运维成本。<br> 一般来说,新增集群节点我们通常有三种方案:</p>
<ul><li>如果业务允许,可以给集群中的表设置 TTL,长时间保留的数据会逐渐被清理到,新增的数据会自动选择新节点,最后会达到负载均衡。</li><li>在集群中建立临时表,将原表中的数据复制到临时表,再删除原表。当数据量较大时,或者表的数量过多时,维护成本较高。同时无法应对实时数据变更。</li><li>通过配置权重的方式,将新写入的数据引导到新的节点。权重维护成本较高。<br> 无论上述的哪一种方案,从时间成本,硬件资源,实时性等方面考虑,ClickHouse 都不是非常适合在线做节点扩缩容及数据充分布。同时,由于 ClickHouse 中无法做到自动探测节点拓扑变化,我们可能需要再 CMDB 中写入一套数据重分布的逻辑。所以我们需要尽可能的提前预估好数据量及节点的数量。</li></ul>
<h3><a name="t15"></a><a id="StarRocks__98"></a>StarRocks 中的在线弹性扩缩容</h3>
<p>与 HDFS 一样,当 StarRocks 集群感知到集群拓扑发生变化的时候,可以做到在线的弹性扩缩容。避免了增加节点对业务的侵入。<br> StarRocks 中的数据采用先分区再分桶的机制进行存储。数据分桶后,会根据分桶键做 hash 运算,结果一致的数据被划分到同一数据分片中,我们称之为 tablet。Tablet 是 StarRocks 中数据冗余的最小单位,通常我们会默认数据以三副本的形式存储,节点中通过 Quorum 协议进行复制。当某个节点发生宕机时,在其他可用的节点上会自动补齐丢失的 tablet,做到无感知的 failover。<br> 在新增节点时,也会有 FE 自动的进行调度,将已有节点中的 tablet 自动的调度到扩容的节点上,做到自动的数据片均衡。为了避免 tablet 迁移时对业务的性能影响,可以尽量选择在业务低峰期进行节点的扩缩容,或者可以动态调整调度参数,通过参数控制 tablet 调度的速度,尽可能的减少对业务的影响。</p>
<h1><a name="t16"></a><a id="ClickHouse__StarRocks__103"></a>ClickHouse 与 StarRocks 的性能对比</h1>
<h2><a name="t17"></a><a id="_SSB__104"></a>单表 SSB 性能测试</h2>
<p>由于 ClickHouse join 能力有限,无法完成 TPCH 的测试,这里使用 SSB 100G 的单表进行测试。</p>
<h3><a name="t18"></a><a id="_106"></a>测试环境</h3>
<div class="table-box"><table><thead><tr><th>机器</th><th>配置 (阿里云主机 3 台)</th></tr></thead><tbody><tr><td>CPU</td><td>64 核 Intel® Xeon® Platinum 8269CY CPU @ 2.5GHz Cache Size: 36608 KB</td></tr><tr><td>内存</td><td>128G</td></tr><tr><td>网络带宽</td><td>100G</td></tr><tr><td>磁盘</td><td>SSD 高效云盘</td></tr><tr><td>ClickHouse 版本</td><td>21.9.5.16-2.x86_64 (18-Oct-2021)</td></tr><tr><td>StarRocks 版本</td><td>v1.19.2</td></tr></tbody></table></div>
<h3><a name="t19"></a><a id="_116"></a>测试数据</h3>
<div class="table-box"><table><thead><tr><th>表名</th><th>行数</th><th>说明</th></tr></thead><tbody><tr><td>lineorder</td><td>6 亿</td><td>SSB 商品订单表</td></tr><tr><td>customer</td><td>300 万</td><td>SSB 客户表</td></tr><tr><td>part</td><td>140 万</td><td>SSB 零部件表</td></tr><tr><td>supplier</td><td>20 万</td><td>SSB 供应商表</td></tr><tr><td>dates</td><td>2556</td><td>日期表</td></tr><tr><td>lineorder_flat</td><td>6 亿</td><td>SSB 打平后的宽表</td></tr></tbody></table></div>
<h3><a name="t20"></a><a id="_127"></a>测试结果</h3>
<p>从测试结果中可以看出来,14 个测试中,有 9 个 SQL,StarRocks 在性能上要超过 ClickHouse。<br> <img src="https://img-blog.csdnimg.cn/c18776fc6508432699b93f2f390f04aa.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"><br> <img src="https://img-blog.csdnimg.cn/700598b872c54ecaad83b32bac64c0d0.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"></p>
<h2><a name="t21"></a><a id="_TPCH__131"></a>多表 TPCH 性能测试</h2>
<p>ClickHouse 不擅长多表关联的场景,对于 TPCH 测试机,很多查询无法跑出,或者 OOM,目前只进行了 StarRocks 的 TPCH 测试。</p>
<h3><a name="t22"></a><a id="_133"></a>测试环境</h3>
<div class="table-box"><table><thead><tr><th>机器</th><th>配置 (阿里云主机 3 台)</th></tr></thead><tbody><tr><td>CPU</td><td>64 核 Intel® Xeon® Platinum 8269CY CPU @ 2.5GHz Cache Size: 36608 KB</td></tr><tr><td>内存</td><td>128G</td></tr><tr><td>网络带宽</td><td>100G</td></tr><tr><td>磁盘</td><td>SSD 高效云盘</td></tr><tr><td>ClickHouse 版本</td><td>21.9.5.16-2.x86_64 (18-Oct-2021)</td></tr><tr><td>StarRocks 版本</td><td>v1.19.2</td></tr></tbody></table></div>
<h3><a name="t23"></a><a id="_144"></a>测试数据</h3>
<p>选用 TPCH 100G 测试集。</p>
<div class="table-box"><table><thead><tr><th>表名</th><th>行数</th></tr></thead><tbody><tr><td>customer</td><td>15000000</td></tr><tr><td>lineitem</td><td>600037902</td></tr><tr><td>nation</td><td>25</td></tr><tr><td>orders</td><td>150000000</td></tr><tr><td>part</td><td>20000000</td></tr><tr><td>partsupp</td><td>80000000</td></tr><tr><td>region</td><td>5</td></tr><tr><td>supplier</td><td>1000000</td></tr></tbody></table></div>
<h3><a name="t24"></a><a id="_158"></a>测试结果</h3>
<p><img src="https://img-blog.csdnimg.cn/a2a2ac66321d42cebaf0a4c5499ce19f.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"></p>
<h2><a name="t25"></a><a id="_160"></a>导入性能测试</h2>
<p>无论是 ClickHouse 还是 StarRocks,我们都可以使用 DataX 进行全量数据的导入,增量部分通过 CDC 工具写入到 MQ 中在经过下游数据库消费即可。</p>
<h3><a name="t26"></a><a id="_162"></a>数据集</h3>
<p>导入测试选取了 <a href="https://ghe.clickhouse.tech/#download-the-dataset">ClickHouse Native Format</a> 数据集。1 个 xz 格式压缩文件大概 85GB 左右,解压后原始文件 1.4T,31 亿条数据,文件格式为 CSV</p>
<h3><a name="t27"></a><a id="_164"></a>导入方式</h3>
<p>ClickHouse 中采用的 HDFS 外表的形式。ClickHouse 中分布式表只能选择一个 integer 列作为 Sharding Key,观察数据发现技术都很低,因此使用 rand() 分布形式。</p>
<pre class="prettyprint"><code class="prism language-sql has-numbering" οnclick="mdcp.copyCode(event)" style="position: unset;"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> github_events_all <span class="token keyword">AS</span> github_events_local \
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> <span class="token keyword">Distributed</span><span class="token punctuation">(</span> \
perftest_3shards_1replicas<span class="token punctuation">,</span> \
github<span class="token punctuation">,</span> \
github_events_local<span class="token punctuation">,</span> \
rand<span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<div class="hljs-button {2}" data-title="复制" data-report-click="{"spm":"1001.2101.3001.4259"}"></div></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li></ul></pre>
<p>HDFS 外表定义如下:</p>
<pre class="prettyprint"><code class="prism language-sql has-numbering" οnclick="mdcp.copyCode(event)" style="position: unset;"><span class="token keyword">CREATE</span> <span class="token keyword">TABLE</span> github_events_hdfs
<span class="token punctuation">(</span>
file_time <span class="token keyword">DateTime</span><span class="token punctuation">,</span>
event_type <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'CommitCommentEvent'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'CreateEvent'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'DeleteEvent'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'ForkEvent'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">,</span>
<span class="token string">'GollumEvent'</span> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'IssueCommentEvent'</span> <span class="token operator">=</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token string">'IssuesEvent'</span> <span class="token operator">=</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token string">'MemberEvent'</span> <span class="token operator">=</span> <span class="token number">8</span><span class="token punctuation">,</span>
<span class="token string">'PublicEvent'</span> <span class="token operator">=</span> <span class="token number">9</span><span class="token punctuation">,</span> <span class="token string">'PullRequestEvent'</span> <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">'PullRequestReviewCommentEvent'</span> <span class="token operator">=</span> <span class="token number">11</span><span class="token punctuation">,</span>
<span class="token string">'PushEvent'</span> <span class="token operator">=</span> <span class="token number">12</span><span class="token punctuation">,</span> <span class="token string">'ReleaseEvent'</span> <span class="token operator">=</span> <span class="token number">13</span><span class="token punctuation">,</span> <span class="token string">'SponsorshipEvent'</span> <span class="token operator">=</span> <span class="token number">14</span><span class="token punctuation">,</span> <span class="token string">'WatchEvent'</span> <span class="token operator">=</span> <span class="token number">15</span><span class="token punctuation">,</span>
<span class="token string">'GistEvent'</span> <span class="token operator">=</span> <span class="token number">16</span><span class="token punctuation">,</span> <span class="token string">'FollowEvent'</span> <span class="token operator">=</span> <span class="token number">17</span><span class="token punctuation">,</span> <span class="token string">'DownloadEvent'</span> <span class="token operator">=</span> <span class="token number">18</span><span class="token punctuation">,</span> <span class="token string">'PullRequestReviewEvent'</span> <span class="token operator">=</span> <span class="token number">19</span><span class="token punctuation">,</span>
<span class="token string">'ForkApplyEvent'</span> <span class="token operator">=</span> <span class="token number">20</span><span class="token punctuation">,</span> <span class="token string">'Event'</span> <span class="token operator">=</span> <span class="token number">21</span><span class="token punctuation">,</span> <span class="token string">'TeamAddEvent'</span> <span class="token operator">=</span> <span class="token number">22</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
actor_login LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
repo_name LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
created_at <span class="token keyword">DateTime</span><span class="token punctuation">,</span>
updated_at <span class="token keyword">DateTime</span><span class="token punctuation">,</span>
<span class="token keyword">action</span> <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'none'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'created'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'added'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'edited'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'deleted'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'opened'</span> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">,</span> <span class="token string">'closed'</span> <span class="token operator">=</span> <span class="token number">6</span><span class="token punctuation">,</span> <span class="token string">'reopened'</span> <span class="token operator">=</span> <span class="token number">7</span><span class="token punctuation">,</span> <span class="token string">'assigned'</span> <span class="token operator">=</span> <span class="token number">8</span><span class="token punctuation">,</span> <span class="token string">'unassigned'</span> <span class="token operator">=</span> <span class="token number">9</span><span class="token punctuation">,</span>
<span class="token string">'labeled'</span> <span class="token operator">=</span> <span class="token number">10</span><span class="token punctuation">,</span> <span class="token string">'unlabeled'</span> <span class="token operator">=</span> <span class="token number">11</span><span class="token punctuation">,</span> <span class="token string">'review_requested'</span> <span class="token operator">=</span> <span class="token number">12</span><span class="token punctuation">,</span> <span class="token string">'review_request_removed'</span> <span class="token operator">=</span> <span class="token number">13</span><span class="token punctuation">,</span> <span class="token string">'synchronize'</span> <span class="token operator">=</span> <span class="token number">14</span><span class="token punctuation">,</span> <span class="token string">'started'</span> <span class="token operator">=</span> <span class="token number">15</span><span class="token punctuation">,</span> <span class="token string">'published'</span> <span class="token operator">=</span> <span class="token number">16</span><span class="token punctuation">,</span> <span class="token string">'update'</span> <span class="token operator">=</span> <span class="token number">17</span><span class="token punctuation">,</span> <span class="token string">'create'</span> <span class="token operator">=</span> <span class="token number">18</span><span class="token punctuation">,</span> <span class="token string">'fork'</span> <span class="token operator">=</span> <span class="token number">19</span><span class="token punctuation">,</span> <span class="token string">'merged'</span> <span class="token operator">=</span> <span class="token number">20</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
comment_id UInt64<span class="token punctuation">,</span>
body String<span class="token punctuation">,</span>
path String<span class="token punctuation">,</span>
position Int32<span class="token punctuation">,</span>
line Int32<span class="token punctuation">,</span>
ref LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
ref_type <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'none'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'branch'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'tag'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'repository'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'unknown'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
creator_user_login LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
number UInt32<span class="token punctuation">,</span>
title String<span class="token punctuation">,</span>
labels Array<span class="token punctuation">(</span>LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
state <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'none'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'open'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'closed'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
locked UInt8<span class="token punctuation">,</span>
assignee LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
assignees Array<span class="token punctuation">(</span>LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
comments UInt32<span class="token punctuation">,</span>
author_association <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'NONE'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'CONTRIBUTOR'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'OWNER'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'COLLABORATOR'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'MEMBER'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'MANNEQUIN'</span> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
closed_at <span class="token keyword">DateTime</span><span class="token punctuation">,</span>
merged_at <span class="token keyword">DateTime</span><span class="token punctuation">,</span>
merge_commit_sha String<span class="token punctuation">,</span>
requested_reviewers Array<span class="token punctuation">(</span>LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
requested_teams Array<span class="token punctuation">(</span>LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
head_ref LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
head_sha String<span class="token punctuation">,</span>
base_ref LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
base_sha String<span class="token punctuation">,</span>
merged UInt8<span class="token punctuation">,</span>
mergeable UInt8<span class="token punctuation">,</span>
rebaseable UInt8<span class="token punctuation">,</span>
mergeable_state <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'unknown'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'dirty'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'clean'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'unstable'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'draft'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">)</span><span class="token punctuation">,</span>
merged_by LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
review_comments UInt32<span class="token punctuation">,</span>
maintainer_can_modify UInt8<span class="token punctuation">,</span>
commits UInt32<span class="token punctuation">,</span>
additions UInt32<span class="token punctuation">,</span>
deletions UInt32<span class="token punctuation">,</span>
changed_files UInt32<span class="token punctuation">,</span>
diff_hunk String<span class="token punctuation">,</span>
original_position UInt32<span class="token punctuation">,</span>
commit_id String<span class="token punctuation">,</span>
original_commit_id String<span class="token punctuation">,</span>
push_size UInt32<span class="token punctuation">,</span>
push_distinct_size UInt32<span class="token punctuation">,</span>
member_login LowCardinality<span class="token punctuation">(</span>String<span class="token punctuation">)</span><span class="token punctuation">,</span>
release_tag_name String<span class="token punctuation">,</span>
release_name String<span class="token punctuation">,</span>
review_state <span class="token keyword">Enum</span><span class="token punctuation">(</span><span class="token string">'none'</span> <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">,</span> <span class="token string">'approved'</span> <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token string">'changes_requested'</span> <span class="token operator">=</span> <span class="token number">2</span><span class="token punctuation">,</span> <span class="token string">'commented'</span> <span class="token operator">=</span> <span class="token number">3</span><span class="token punctuation">,</span> <span class="token string">'dismissed'</span> <span class="token operator">=</span> <span class="token number">4</span><span class="token punctuation">,</span> <span class="token string">'pending'</span> <span class="token operator">=</span> <span class="token number">5</span><span class="token punctuation">)</span>
<span class="token punctuation">)</span>
<span class="token keyword">ENGINE</span> <span class="token operator">=</span> HDFS<span class="token punctuation">(</span><span class="token string">'hdfs://XXXXXXXXXX:9000/user/stephen/data/github-02/*'</span><span class="token punctuation">,</span> <span class="token string">'TSV'</span><span class="token punctuation">)</span>
<div class="hljs-button {2}" data-title="复制" data-report-click="{"spm":"1001.2101.3001.4259"}"></div></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li><li style="color: rgb(153, 153, 153);">11</li><li style="color: rgb(153, 153, 153);">12</li><li style="color: rgb(153, 153, 153);">13</li><li style="color: rgb(153, 153, 153);">14</li><li style="color: rgb(153, 153, 153);">15</li><li style="color: rgb(153, 153, 153);">16</li><li style="color: rgb(153, 153, 153);">17</li><li style="color: rgb(153, 153, 153);">18</li><li style="color: rgb(153, 153, 153);">19</li><li style="color: rgb(153, 153, 153);">20</li><li style="color: rgb(153, 153, 153);">21</li><li style="color: rgb(153, 153, 153);">22</li><li style="color: rgb(153, 153, 153);">23</li><li style="color: rgb(153, 153, 153);">24</li><li style="color: rgb(153, 153, 153);">25</li><li style="color: rgb(153, 153, 153);">26</li><li style="color: rgb(153, 153, 153);">27</li><li style="color: rgb(153, 153, 153);">28</li><li style="color: rgb(153, 153, 153);">29</li><li style="color: rgb(153, 153, 153);">30</li><li style="color: rgb(153, 153, 153);">31</li><li style="color: rgb(153, 153, 153);">32</li><li style="color: rgb(153, 153, 153);">33</li><li style="color: rgb(153, 153, 153);">34</li><li style="color: rgb(153, 153, 153);">35</li><li style="color: rgb(153, 153, 153);">36</li><li style="color: rgb(153, 153, 153);">37</li><li style="color: rgb(153, 153, 153);">38</li><li style="color: rgb(153, 153, 153);">39</li><li style="color: rgb(153, 153, 153);">40</li><li style="color: rgb(153, 153, 153);">41</li><li style="color: rgb(153, 153, 153);">42</li><li style="color: rgb(153, 153, 153);">43</li><li style="color: rgb(153, 153, 153);">44</li><li style="color: rgb(153, 153, 153);">45</li><li style="color: rgb(153, 153, 153);">46</li><li style="color: rgb(153, 153, 153);">47</li><li style="color: rgb(153, 153, 153);">48</li><li style="color: rgb(153, 153, 153);">49</li><li style="color: rgb(153, 153, 153);">50</li><li style="color: rgb(153, 153, 153);">51</li><li style="color: rgb(153, 153, 153);">52</li><li style="color: rgb(153, 153, 153);">53</li><li style="color: rgb(153, 153, 153);">54</li><li style="color: rgb(153, 153, 153);">55</li><li style="color: rgb(153, 153, 153);">56</li><li style="color: rgb(153, 153, 153);">57</li><li style="color: rgb(153, 153, 153);">58</li><li style="color: rgb(153, 153, 153);">59</li><li style="color: rgb(153, 153, 153);">60</li><li style="color: rgb(153, 153, 153);">61</li><li style="color: rgb(153, 153, 153);">62</li><li style="color: rgb(153, 153, 153);">63</li><li style="color: rgb(153, 153, 153);">64</li></ul></pre>
<p>在 StarRocks 中,采用 Broker Load 的模式进行导入,导入命令如下:</p>
<pre class="prettyprint"><code class="prism language-sql has-numbering" οnclick="mdcp.copyCode(event)" style="position: unset;"><span class="token keyword">LOAD</span> LABEL github<span class="token punctuation">.</span>xxzddszxxzz <span class="token punctuation">(</span>
<span class="token keyword">DATA</span> <span class="token keyword">INFILE</span><span class="token punctuation">(</span><span class="token string">"hdfs://XXXXXXXXXX:9000/user/stephen/data/github/*"</span><span class="token punctuation">)</span>
<span class="token keyword">INTO</span> <span class="token keyword">TABLE</span> <span class="token punctuation">`</span>github_events<span class="token punctuation">`</span>
<span class="token punctuation">(</span>event_type<span class="token punctuation">,</span>repo_name<span class="token punctuation">,</span>created_at<span class="token punctuation">,</span>file_time<span class="token punctuation">,</span>actor_login<span class="token punctuation">,</span>updated_at<span class="token punctuation">,</span><span class="token keyword">action</span><span class="token punctuation">,</span>comment_id<span class="token punctuation">,</span>body<span class="token punctuation">,</span>path<span class="token punctuation">,</span>position<span class="token punctuation">,</span>line<span class="token punctuation">,</span>ref<span class="token punctuation">,</span>ref_type<span class="token punctuation">,</span>creator_user_login<span class="token punctuation">,</span>number<span class="token punctuation">,</span>title<span class="token punctuation">,</span>labels<span class="token punctuation">,</span>state<span class="token punctuation">,</span>locked<span class="token punctuation">,</span>assignee<span class="token punctuation">,</span>assignees<span class="token punctuation">,</span>comments<span class="token punctuation">,</span>author_association<span class="token punctuation">,</span>closed_at<span class="token punctuation">,</span>merged_at<span class="token punctuation">,</span>merge_commit_sha<span class="token punctuation">,</span>requested_reviewers<span class="token punctuation">,</span>requested_teams<span class="token punctuation">,</span>head_ref<span class="token punctuation">,</span>head_sha<span class="token punctuation">,</span>base_ref<span class="token punctuation">,</span>base_sha<span class="token punctuation">,</span>merged<span class="token punctuation">,</span>mergeable<span class="token punctuation">,</span>rebaseable<span class="token punctuation">,</span>mergeable_state<span class="token punctuation">,</span>merged_by<span class="token punctuation">,</span>review_comments<span class="token punctuation">,</span>maintainer_can_modify<span class="token punctuation">,</span>commits<span class="token punctuation">,</span>additions<span class="token punctuation">,</span>deletions<span class="token punctuation">,</span>changed_files<span class="token punctuation">,</span>diff_hunk<span class="token punctuation">,</span>original_position<span class="token punctuation">,</span>commit_id<span class="token punctuation">,</span>original_commit_id<span class="token punctuation">,</span>push_size<span class="token punctuation">,</span>push_distinct_size<span class="token punctuation">,</span>member_login<span class="token punctuation">,</span>release_tag_name<span class="token punctuation">,</span>release_name<span class="token punctuation">,</span>review_state<span class="token punctuation">)</span>
<span class="token punctuation">)</span>
<span class="token keyword">WITH</span> BROKER oss_broker1 <span class="token punctuation">(</span><span class="token string">"username"</span><span class="token operator">=</span><span class="token string">"user"</span><span class="token punctuation">,</span> <span class="token string">"password"</span><span class="token operator">=</span><span class="token string">"password"</span><span class="token punctuation">)</span>
PROPERTIES
<span class="token punctuation">(</span>
<span class="token string">"max_filter_ratio"</span> <span class="token operator">=</span> <span class="token string">"0.1"</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<div class="hljs-button {2}" data-title="复制" data-report-click="{"spm":"1001.2101.3001.4259"}"></div></code><ul class="pre-numbering" style=""><li style="color: rgb(153, 153, 153);">1</li><li style="color: rgb(153, 153, 153);">2</li><li style="color: rgb(153, 153, 153);">3</li><li style="color: rgb(153, 153, 153);">4</li><li style="color: rgb(153, 153, 153);">5</li><li style="color: rgb(153, 153, 153);">6</li><li style="color: rgb(153, 153, 153);">7</li><li style="color: rgb(153, 153, 153);">8</li><li style="color: rgb(153, 153, 153);">9</li><li style="color: rgb(153, 153, 153);">10</li></ul></pre>
<h3><a name="t28"></a><a id="_256"></a>导入结果</h3>
<p>可以看出,在使用 github 数据集进行导入的时候,基本上 StarRocks 和 ClickHouse 导入的性能相差不多。<br> <img src="https://img-blog.csdnimg.cn/c1b0c3417f634f15b186081424f3bca9.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/daf9c4ea48c64e2cb5d20aa80a625ffe.png?x-oss-process=image/watermark,type_d3F5LXplbmhlaQ,shadow_50,text_Q1NETiBAZGFuMjAyMTE=,size_20,color_FFFFFF,t_70,g_se,x_16" alt="在这里插入图片描述"></p>
<h1><a name="t29"></a><a id="_261"></a>结论</h1>
<p>ClickHouse 与 StarRocks 都是很优秀的关系新 OLAP 数据库。两者有着很多的相似之处,对于分析类查询都提供了极致的性能,都不依赖于 Hadoop 生态圈。从本次的选型对比中,可以看出在一些场景下,StarRocks 相较于 ClickHouse 有更好的表现。一般来说,ClickHouse 适合于维度变化较少的拼宽表的场景,StarRocks 不仅在单表的测试中有着更出色的表现,在多表关联的场景具有更大的优势。</p>
</div>
Clickhouse VS StarRocks
最新推荐文章于 2024-05-20 13:29:35 发布