# Bulk MemTable 加速批量写入，SELECT Processor 新增列选功能｜Greptime 双周精选

Source: https://greptime.cn/blogs/2025-05-14-biweekly-report-greptimedb

## 内容概述

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

最近的更新内容如下：
- **实现 Bulk MemTable，加速大批量写入请求速度**
- **Pipeline 新增 SELECT processor**

## 社区贡献者名单

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

祝贺以下各位在过去 2 周内成为我们最突出的贡献者：
> - @[omahs](https://github.com/omahs) [db#6084](https://github.com/GreptimeTeam/greptimedb/pull/6084)
> - @[zqr10159](https://github.com/zqr10159) [docs#1722](https://github.com/GreptimeTeam/docs/pull/1722)

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

<figure>
<img src="/zh/blogs/2025-05-14-biweekly-report-greptimedb/contributors.png" alt="（图 1：GreptimeDB 双周内新增贡献者）" style="width: 80%; margin: 0 auto"/>
<figcaption>（图 1：GreptimeDB 双周内新增贡献者）</figcaption>
</figure>

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

## PR 亮点

### [db#6054 新增 Bulk MemTable](https://githubcom/GreptimeTeam/greptimedb/pull/6054)

引入了 Bulk MemTable，该设计显著提升了大批量写入请求的写入速度。目前，该功能仅在无主键表中启用。

### [db#5939 为 PromQL HTTP API 添加更多格式支持](https://github.com/GreptimeTeam/greptimedb/pull/5939)

PromQL HTTP API 的查询结果现在支持更多格式，包括`arrow`，`csv`，`influxdb_v1`，`greptimedb_v1` 和 `json`，方便用户使用不同的格式处理查询结果，使用示例如下：

```bash
> curl "localhost:4000/v1/promql?query=1&start=0&end=15&step=5s&format=csv"
0,1.0
5000,1.0
10000,1.0
15000,1.0
```

### [db#6019 Pipeline 新增 `SELECT` Processor](https://github.com/GreptimeTeam/greptimedb/pull/6019)

Pipeline 添加了一个新的 `SELECT` Processor，用于便捷地选择或排除 Pipeline 中的特定列。

如下所示，文中 Pipeline 中的 `SELECT` Processor 从之前已有的四列（ `ts`，`http_status_code`，`content`和 `message` ）中选取了两列 `ts` 和 `http_status_code`：

```yaml
processors:
  - dissect:
      fields:
        - message
      patterns:
        - "%{+ts} %{+ts} %{http_status_code} %{content}"
  - date:
      fields:
        - ts
      formats:
        - "%Y-%m-%d %H:%M:%S%.3f"
  - select:
      fields:
        - ts
        - http_status_code
```

### [db#6073 内置的内存分析器支持生成火焰图](https://github.com/GreptimeTeam/greptimedb/pull/6073)

内置的内存分析器现在支持通过 HTTP API 直接输出火焰图了，对于快速分析内存占用很有帮助，Linux 上使用的用例如下：

```bash
# start the db with profiler on
MALLOC_CONF=prof:true greptime standalone start
# dump the flamegraph
curl -X POST "localhost:4000/debug/prof/mem?output=flamegraph" > greptime.svg
```

<figure>
<img src="/zh/blogs/2025-05-14-biweekly-report-greptimedb/flamegraph.png" alt="（图 2：火焰图示例）" style="width: 80%; margin: 0 auto"/>
<figcaption>（图 2：火焰图示例）</figcaption>
</figure>

## Good First Issue

### [Issue#6067 支持新格式 CSVWithNames 和 CSVWithNamesAndTypes](https://github.com/GreptimeTeam/greptimedb/issues/6067)

我们目前支持将 SQL 和 PromQL 的查询结果渲染为 CSV 格式（详见 [CSV 结果格式](https://github.com/GreptimeTeam/greptimedb/blob/main/src/servers/src/http/result/csv_result.rs)及其在 `/sql` [API 中的实现链接](https://github.com/GreptimeTeam/greptimedb/blob/51f2cb10531ba488c5f849748c6631888fd32a23/src/servers/src/http/handler.rs#L141)），但现有的 CSV 输出仅包含数据行，缺少列名和列类型信息。

ClickHouse 的 CSVWithNames（包含列名作为表头）和 CSVWithNamesAndTypes（同时包含列名和类型）格式能显著提升数据可用性。这些格式的加入将极大便利用户在 Excel 等工具中进行数据导入和分析操作。因此，建议支持这两种增强型 CSV 格式。

难度：简单

关键字：SQL，Query，CSV

### [Issue#6068 支持添加/删除列的默认值](https://github.com/GreptimeTeam/greptimedb/issues/6068)

支持 `ALTER TABLE <table-name> ALTER COLUMN <column-name> SET DEFAULT <default-value>/DROP DEFAULT` 来帮助列添加或者删除默认值。

难度：中等

关键字：Alter table, Default value

---
## 关于 Greptime

Greptime 格睿科技专注于打造新一代可观测性数据库，服务开发者与企业用户，覆盖从从边缘设备到云端企业级部署的多样化需求。

- [GreptimeDB 开源版](https://greptime.cn/product/db)：开源、云原生，统一处理指标、日志和追踪数据，适合中小规模 IoT，个人项目与可观测性场景；
- [GreptimeDB 企业版](https://greptime.cn/product/enterprise)：面向关键业务，提供更高性能、高安全性、高可用性和智能化运维服务；
- [GreptimeCloud 云服务](https://greptime.cn/product/cloud)：全托管云服务，零运维体验“企业级”可观测性数据库，弹性扩展，按需付费。

欢迎加入开源社区参与贡献与交流！推荐从带有 `good first issue` 标签的任务入手，一起共建可观测未来。

⭐ [Star us on GitHub](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/)
