# 释放非结构化数据的潜力，新增 JSON 类型支持 | Greptime 双周精选

Source: https://greptime.cn/blogs/2024-10-09-biweekly-report

## 内容概述

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

最近的内容更新如下：

- **支持了 `JSON` 数据类型，并且添加了一些常用的 `UDF`s：`get_by_path` 和 `json_is`**

- **新增了更多的 H3 地理空间函数，用于处理和分析空间数据**

- **在 `information_schema` 中新增了 `procedure_info` 和 `region_statistics` 表，提升了系统的可观测性**

- **使用 `batch` 模式优化了 `Flow` 的性能**

- **增加了慢查询日志功能**

- **更新 `pgwire` 以解决连接建立的潜在问题**

## 社区贡献者名单

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

祝贺以下各位在过去 2 周内成为我们活跃的贡献者：

- @[CookiePieWw](https://github.com/CookiePieWw) ([db#4770](https://github.com/GreptimeTeam/greptimedb/pull/4720) [db#4742](https://github.com/GreptimeTeam/greptimedb/pull/4742) [db#4726](https://github.com/GreptimeTeam/greptimedb/pull/4726) [db#4515](https://github.com/GreptimeTeam/greptimedb/pull/4515) [docs#1196](https://github.com/GreptimeTeam/docs/pull/1196))

- @[haoqixu](https://github.com/haoqixu) ([db-ingester-go#39](https://github.com/GreptimeTeam/greptimedb-ingester-go/pull/39))

- @[J0HN50N133](https://github.com/J0HN50N133) ([db#4774](https://github.com/GreptimeTeam/greptimedb/pull/4774) [db#4729](https://github.com/GreptimeTeam/greptimedb/pull/4729))

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

- @[lyang24](https://github.com/lyang24) ([db#4699](https://github.com/GreptimeTeam/greptimedb/pull/4699))

- @[poltao](https://github.com/poltao) ([db#4675](https://github.com/GreptimeTeam/greptimedb/pull/4675))

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

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

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

## PR 亮点
### [db#4619](https://github.com/GreptimeTeam/greptimedb/pull/4619) [db#4515](https://github.com/GreptimeTeam/greptimedb/pull/4515) [db#4720](https://github.com/GreptimeTeam/greptimedb/pull/4720) `JSON` 数据类型支持

JSON 数据类型支持取得了一些进展。

  - `RFC` 和实现均合入了主分支；
  - 为 `JSON` 类型添加常用的 `UDF`s：`get_by_path`，`json_is`。

### [db#4719](https://github.com/GreptimeTeam/greptimedb/pull/4719) 实现了慢查询日志

慢查询日志功能主要用于记录执行时间较长的查询语句。通过分析慢查询日志，开发者可以发现哪些查询语句执行效率低下，从而有针对性地进行优化，提升数据库整体性能。

### [db#4675](https://github.com/GreptimeTeam/greptimedb/pull/4675) 增强 `procedure` 的可观测性

在此 pr 之前，无法查看每个 `procedure` 的状态，导致难以调试或者验证某个特定 `procedure` 相关的内容。所以，此 pr 在 `information_schema` 中新增了 `procedure_info` 表，我们可以通过查询该表来获取 `procedure` 的状态，包括 `procedure_id`，`procedure_type`，`start_time`，`end_time`，`lock_keys` 等 。

下面是一个查询示例：

```sql
select * from information_schema.procedure_info \G
```

查询结果显示为：

```sql
*************************** 1. row ***************************
  procedure_id: 140ae3dd-da22-4f5d-a447-debe55e6bbb1
procedure_type: metasrv-procedure::DropTable
    start_time: 2024-09-13 14:42:29.298000
      end_time: 2024-09-13 14:42:29.309000
        status: Done
     lock_keys: Share("__catalog_lock/greptime"),Share("__schema_lock/greptime.public"),Exclusive("__table_lock/1044")
*************************** 2. row ***************************
  procedure_id: 2a6d3155-b2c0-4503-81d7-a981393b08fb
procedure_type: metasrv-procedure::CreateTable
    start_time: 2024-09-13 14:42:33.490000
      end_time: 2024-09-13 14:42:33.498000
        status: Done
     lock_keys: Share("__catalog_lock/greptime"),Share("__schema_lock/greptime.public"),Exclusive("__table_name_lock/greptime.public.temperatures")
2 rows in set (0.01 sec)
```

### [db#4771](https://github.com/GreptimeTeam/greptimedb/pull/4771) 增强 `Region` 的可观测性

在 `information_schema` 新增了 `region_statistics` 表，我们可以通过查询该表来获取 `Region` 的统计信息，包括 `table_id`，`region_number`，`memtable_size` 等信息。

下面是一个查询示例：

```sql
select * from information_schema.region_statistics;
```
查询结果显示为：

```sql
+---------------+----------+---------------+---------------+---------------+-----------+--------+-------------+
| region_id     | table_id | region_number | memtable_size | manifest_size | sst_size  | engine | region_role |
+---------------+----------+---------------+---------------+---------------+-----------+--------+-------------+
| 4440996184064 |     1034 |             0 |       3586817 |         11704 | 301876450 | mito   | Leader      |
| 4432406249472 |     1032 |             0 |     269686817 |         12508 | 279053485 | mito   | Leader      |
| 4445291151360 |     1035 |             0 |      56686817 |          9232 | 297195520 | mito   | Leader      |
| 4436701216768 |     1033 |             0 |     239386817 |          9139 | 281388451 | mito   | Leader      |
+---------------+----------+---------------+---------------+---------------+-----------+--------+-------------+
4 rows in set (0.01 sec)
```

## Good First Issue

### [db#3262 提供一个官方的 `Grafana` 配置](https://github.com/GreptimeTeam/greptimedb/issues/3262)

为 GreptimeDB 提供一个直观的开箱即用的 `Grafana` 仪表板。

关键词：Grafana

难度：中等

### [db#4805 添加更多的 `JSON` `UDF`s](https://github.com/GreptimeTeam/greptimedb/issues/4805)

添加更多关于 `JSON` 数据类型的 `UDF`s，实现强大的查询功能。

关键词：JSON，UDF

难度：简单

---

## 关于 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/
