# 社区 Committer +1！GreptimeDB 排序性能优化 | Greptime 双周精选

Source: https://greptime.cn/blogs/2024-11-06-biweekly-report

## 内容概述

作为一个成长中的开源项目，GreptimeDB 的进展离不开来自全球的社区贡献者们，感谢各位！

最近的内容更新如下：

- **排序性能优化**：引入 Part Sort 物理算子和 Windowed Sort 规则

- **引入资源限制机制**：可在资源受限环境（尤其是嵌入式设备）中发挥作用

- **存储引擎性能提升**：通过按时间范围缓存 Row Group 加速查询

- **动态表选项变更**：允许动态修改表的 TTL

## 社区贡献者名单

在过去的两周里，GreptimeDB 共合并了 **88 个**PR，其中有 **3 位**独立贡献者，累计 **5 个** PR 被成功合并，还有很多待合并的 PR。

- @[CookiePieWw](https://github.com/CookiePieWw) ([db#4933](https://github.com/GreptimeTeam/greptimedb/pull/4933) [db#4919](https://github.com/GreptimeTeam/greptimedb/pull/4919) [db#4893](https://github.com/GreptimeTeam/greptimedb/pull/4893))

- @[Kev1n8](https://github.com/Kev1n8)（[db#4864](https://github.com/GreptimeTeam/greptimedb/pull/4864)）

- @[ActivePeter](https://github.com/ActivePeter)（[db#4782](https://github.com/GreptimeTeam/greptimedb/pull/4782)）

👏 欢迎 @[ActivePeter](https://github.com/ActivePeter) 作为新的贡献者加入到社区，并成功合并了 PR，还有更多来自其他独立贡献者的 PR 正在等待合并。

<figure>
<img src="/zh/blogs/2024-11-06-biweekly-report/contributorpost.png" alt="GreptimeDB 的新晋独立贡献者" style="width: 40%; margin: 0 auto"/>
<figcaption>GreptimeDB 的新晋独立贡献者</figcaption>
</figure>

🎉 根据 GreptimeDB 社区 2024.11.1 的 Committer 晋升投票结果，@[lyang24](https://github.com/lyang24) 由于其优质 PR和长期贡献正式被晋升为新的 Committer，期待你在社区的更多贡献！

<figure>
<img src="/zh/blogs/2024-11-06-biweekly-report/nomination.png" alt="Committer 提名" style="width: 40%; margin: 0 auto"/>
<figcaption>Committer 提名</figcaption>
</figure>

😄 热烈欢迎 @[lyang24](https://github.com/lyang24) 这位独立贡献者正式作为新的 Committer 入驻社区，感谢你付出的努力，希望我们继续携手前行，共建社区。

<figure>
<img src="/zh/blogs/2024-11-06-biweekly-report/committerpost.png" alt="Committer 晋升成功" style="width: 40%; margin: 0 auto"/>
<figcaption>Committer 晋升成功</figcaption>
</figure>

衷心感谢我们所有的成员和贡献者！是你们的付出让我们的项目得以成功，也是你们让 GreptimeDB 成为一个更优质的产品。让我们一起努力，建立一个更棒的社区！

## PR 亮点

### [db#4847](https://github.com/GreptimeTeam/greptimedb/pull/4847) [db#4922](https://github.com/GreptimeTeam/greptimedb/pull/4922) 引入 PartSort 物理算子

新增 PartSort 物理算子，用于在 PartitionRange 边界内对数据进行排序，在 PartSort 算子中实现了简单的 Limit 机制。

### [db#4874](https://github.com/GreptimeTeam/greptimedb/pull/4874) 引入 Windowed Sort 规则

通过引入 Windowed Sort 规则，优化器得以利用 PartSort 物理算子，从而提升了整体排序性能。

### [db#4859](https://github.com/GreptimeTeam/greptimedb/pull/4859) OpenTelemetry 数据写入增强

增强 OpenTelemetry 写入功能，支持从属性中提取字段进行索引，提高数据处理灵活性。

### [db#4782](https://github.com/GreptimeTeam/greptimedb/pull/4782) CPU 使用率限制机制

实现了 CPU 使用率限制机制，以便在资源受限的环境（如嵌入式设备）中高效运行。

### [db#4864](https://github.com/GreptimeTeam/greptimedb/pull/4864) 新增 `JSON` 用户定义函数 `json_path_match`

实现了新的 `JSON` 用户定义函数 `json_path_match`，以扩展 `JSON` 数据处理能力。

### [db#4871](https://github.com/GreptimeTeam/greptimedb/pull/4871) 存储引擎分离调度器

通过将 Flush 和 Compaction 任务的调度器分开，优化存储引擎，解决了调度器阻塞问题。

### [db#4869](https://github.com/GreptimeTeam/greptimedb/pull/4869) 存储引擎按时间范围缓存 Row Group

按时间范围缓存 Row Group 并在后续查询中检索，显著提升了查询性能。

### [db#4848](https://github.com/GreptimeTeam/greptimedb/pull/4848) 支持动态变更表选项

支持通过 SQL 语法动态修改表选项（如 TTL），增强了表的灵活性。
语法如下：

```sql
ALTER TABLE <table_name> SET <option_name>=<option_value>[, ...];
```

### [db#4909](https://github.com/GreptimeTeam/greptimedb/pull/4909) 细化 `region_statistics` 表

在 `information_schema.region_statistics` 中新增列 `disk_size`，`region_rows` 和 `index_size`，以提供更详细的 Region 统计信息。

### [db#4908](https://github.com/GreptimeTeam/greptimedb/pull/4908) 通过 gRPC 协议插入 `JSON` 数据

实现了通过 gRPC 协议插入 `JSON` 数据的功能，拓展了 `JSON` 数据写入方式。

## Good First Issue

### [db#4935 修复 `region_stats` 测试](https://github.com/GreptimeTeam/greptimedb/issues/4935)

修复测试用例 `tests::instance_test::test_use_database`。

关键词：Region

难度：简单

### [db#4932 统一 Frontend 和 Metasrv 内的 Datanode 选项](https://github.com/GreptimeTeam/greptimedb/issues/4932)

两个相同功能的 Datanode 选项分别处于 `frontend::service_config::datanode` 和 `meta_srv::metasrv`，需要进行统一。

关键词：Config

难度：简单

---

## 关于 Greptime

[Greptime 格睿科技](https://greptime.cn/)专注于为可观测、物联网及车联网等领域提供实时、高效的数据存储和分析服务，帮助客户挖掘数据的深层价值。目前基于云原生的时序数据库 [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) 已经衍生出多款适合不同用户的解决方案，更多信息或 demo 展示请联系下方小助手（微信号：greptime）。

欢迎对开源感兴趣的朋友们参与贡献和讨论，从带有 good first issue 标签的 issue 开始你的开源之旅吧～期待在开源社群里遇见你！添加小助手微信即可加入“技术交流群”与志同道合的朋友们面对面交流哦~

Star us on GitHub Now: https://github.com/GreptimeTeam/greptimedb

官网：https://greptime.cn/

文档：https://docs.greptime.cn/

Twitter: https://twitter.com/Greptime

Slack: https://greptime.com/slack

LinkedIn: https://www.linkedin.com/company/greptime/
