Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/reference/sql/greptime-private/events.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@ with Metasrv can additionally record operational event types. Event recording is
asynchronous and best-effort, so rows are not an acknowledgement that an
operation succeeded.

The table is created when the first event is recorded. If no event has been
recorded, or event recording is disabled, querying it returns a table-not-found
error. Configure recording in [Event recording](/user-guide/deployments-administration/configuration.md#event-recording).
When the event recorder writes its first event, it creates the
`greptime_private.events` system table. If an existing table is missing columns
from the current event schema, the recorder adds them. It performs both actions
even when automatic table creation is disabled. Disabling event recording does
not remove an existing table. A query returns a table-not-found error only if the
table does not currently exist, for example because event recording was disabled
before any event was recorded or the table was dropped. The recorder recreates the
table when it writes another event. Configure recording in [Event recording](/user-guide/deployments-administration/configuration.md#event-recording).

```sql
USE greptime_private;
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/sql/greptime-private/slow_queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ description: The slow queries table in the `greptime_private` database.
# slow_queries

The `slow_queries` table records SQL and PromQL queries selected by the slow-query recorder.
When the slow-query recorder writes to `greptime_private.slow_queries`, it creates
the table if it does not exist and adds any missing columns to an existing table.
It performs both actions even when automatic table creation is disabled.

:::tip NOTE
The `slow_queries` table requires slow query logging to be enabled. See [Slow Query](/user-guide/deployments-administration/monitoring/slow-query.md) for configuration details.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,14 @@ See [Event recording](/user-guide/deployments-administration/configuration.md#ev

## Query events

The table is created when the first event is recorded. If no event has been
recorded yet, or event recording is disabled, this query returns a table-not-found
error.
When the event recorder writes its first event, it creates the
`greptime_private.events` system table. If an existing table is missing columns
from the current event schema, the recorder adds them. It performs both actions
even when automatic table creation is disabled. Disabling event recording does
not remove an existing table. This query returns a table-not-found error only if
the table does not currently exist, for example because event recording was
disabled before any event was recorded or the table was dropped. The recorder
recreates the table when it writes another event.

Start with a bounded query while investigating a recent operation:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ description: greptime_private 数据库中的 events 表。

`events` 表保存 GreptimeDB 运行期间产生的事件。单机部署记录受支持的本地 DDL Procedure 事件;带有 Metasrv 的分布式部署还可以记录运维事件。事件会异步写入,写入失败不会影响原操作的执行结果。因此,不能以事件是否出现作为操作成功的依据。

该表会在首次记录事件时自动创建。如果还没有事件记录,或已禁用事件记录,查询会提示表不存在。配置方法请参阅[事件记录配置](/user-guide/deployments-administration/configuration.md#事件记录配置)。
事件记录器首次写入事件时会创建 `greptime_private.events` 系统表。如果现有表缺少当前事件表结构中的列,记录器会补齐这些列。即使自动建表已禁用,仍会执行这两项操作。禁用事件记录不会删除已有表。只有该表当前不存在时,查询才会提示表不存在,例如从启动时就禁用了事件记录,或者表已被删除。事件记录器在下一次写入事件时会重新创建该表。配置方法请参阅[事件记录配置](/user-guide/deployments-administration/configuration.md#事件记录配置)。

```sql
USE greptime_private;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ description: greptime_private 数据库中的慢查询表。
# slow_queries

`slow_queries` 表记录被慢查询记录器选中的 SQL 和 PromQL 查询。
慢查询记录器写入 `greptime_private.slow_queries` 时,如果表不存在会创建表;如果现有表缺少列,则会补齐这些列。即使自动建表已禁用,仍会执行这两项操作。

:::tip 注意
`slow_queries` 表需要开启慢查询日志功能。详见[慢查询](/user-guide/deployments-administration/monitoring/slow-query.md)配置说明。
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GreptimeDB 会异步写入事件记录,通常每 5 秒刷新一次。刚完成

## 查询事件

事件表会在首次记录事件时创建。尚未记录任何事件,或已禁用事件记录时,下面的查询会报表不存在
事件记录器首次写入事件时会创建 `greptime_private.events` 系统表。如果现有表缺少当前事件表结构中的列,记录器会补齐这些列。即使自动建表已禁用,仍会执行这两项操作。禁用事件记录不会删除已有表。只有该表当前不存在时,下面的查询才会报表不存在,例如从启动时就禁用了事件记录,或者表已被删除。事件记录器在下一次写入事件时会重新创建该表

排查最近的操作时,可以先查询最近一小时的事件,并将结果限制为 20 条:

Expand Down
Loading