# 内存优化、查询提速，全新日志视图功能上线 | Greptime 双周精选

Source: https://greptime.cn/blogs/2024-12-18-biweekly-report

## 内容概述

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

最近的内容更新如下：

- **优化日志写入量级高时的内存占用**

- **引入新的跳数索引语法**

- **引入对 PostgreSQL 的 CURSOR 语句支持**

- **减少 last-point 查询时缓存文件大小**

- **通过从对象存储上预取索引文件减少 IO 等待时间**

- **新增日志视图功能**

## 社区贡献者名单

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

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

- @[linyihai](https://github.com/linyihai) ([db#5166](https://github.com/GreptimeTeam/greptimedb/pull/5166) [db#5088](https://github.com/GreptimeTeam/greptimedb/pull/5088))

- @[NiwakaDev](https://github.com/NiwakaDev)([db#5165](https://github.com/GreptimeTeam/greptimedb/pull/5165) [db#5129](https://github.com/GreptimeTeam/greptimedb/pull/5129))

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

## PR 亮点

### [db#5135](https://github.com/GreptimeTeam/greptimedb/pull/5135) [db#5157](https://github.com/GreptimeTeam/greptimedb/pull/5157) 减少日志写入时的内存占用

我们最近构建了一次新的日志场景性能测试，并基于测试的分析结果做了一些改进。通过在 compaction 期间避免持有无效缓存和内存表，在高日志写入速率和高频 compaction 的场景下极大程度上减少了内存占用，平均从 5.5GB 降低到了 500MB。

### [db#5095](https://github.com/GreptimeTeam/greptimedb/pull/5095) 减少 last-point 查询的缓存文件大小

通过构建新的返回结果而不是一直持有旧的数据，我们在 last-point 查询场景下大幅减少了缓存文件的容量大小。在 TSBS 标准测试结果中缓存文件大小从 1GB 降低到了 8.3MB。

### [db#5145](https://github.com/GreptimeTeam/greptimedb/pull/5145) [db#5146](https://github.com/GreptimeTeam/greptimedb/pull/5146) 通过预取索引文件减少查询时 IO 等待时间

我们的索引文件和数据文件都存储在对象存储上。当查询落到对象存储上时，我们使用预取索引文件的方式减少了总计 IO 等待时间，平均从 40ms 降低到了 10ms。

### [db#5155](https://github.com/GreptimeTeam/greptimedb/pull/5155) [db#5177](https://github.com/GreptimeTeam/greptimedb/pull/5177) 引入跳数索引语法

除了倒排索引和全文索引，我们正在为文本搜索和匹配开发一种新的跳数索引（通过布隆过滤器实现）。这种新的索引类型会极大减少构建全文索引的成本的同时达到近似相同的查询耗时。布隆过滤器的实现追踪可以看这里：[db#5176](https://github.com/GreptimeTeam/greptimedb/issues/5176)。

### [db#5081](https://github.com/GreptimeTeam/greptimedb/pull/5081) [db#5094](https://github.com/GreptimeTeam/greptimedb/pull/5094) 引入 PostgreSQL 中的 CURSOR 语句

初步支持 PostgreSQL 中的 CURSOR 语句。我们希望通过实现 PostgreSQL 的外部数据包装器（foreign data wrapper）协议来作为 PostgreSQL 的数据源兼容服务端。

### [db#5172](https://github.com/GreptimeTeam/greptimedb/pull/5172) 新增日志视图功能

在最新的 dashboard 版本中，我们发布了一个新的日志查看和分析工具日志视图（Log View）。Log View 能方便地查看和分析数据库中的日志数据。我们希望通过不停的迭代使 Log View 成为一个强大日志分析工具。更多介绍请参考此文：[《GreptimeDB Dashboard UI 新增日志视图功能》](https://greptime.cn/blogs/2024-12-17-log-view-introduction)。

## Good First Issue

### [db#5120 实现多种向量运算函数](https://github.com/GreptimeTeam/greptimedb/issues/5120)

关键词：Vector

难度：简单

---

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