Skip to content
Open
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
58 changes: 58 additions & 0 deletions docs/sys-utilities/pg-test-fsync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
title: pg_test_fsync
---


# pg_test_fsync

Determines the fastest `wal_sync_method`, which specifies the method used for forcing write-ahead log (WAL) updates out to disk for Cloudberry Database.


## Synopsis

```shell
pg_test_fsync [<option> ...]

pg_test_fsync -? | --help

pg_test_fsync -V | --version
```


## Description

`pg_test_fsync` is a standard PostgreSQL utility that you can use to determine what the fastest `wal_sync_method` is on your specific system. It also provides diagnostic information in the event of an identified I/O problem. However, differences reported by `pg_test_fsync` might not significantly impact real-world database throughput, because many database servers are not speed-limited by their write-ahead logs.

`pg_test_fsync` reports the average time for file synchronization operations, measured in microseconds, for each `wal_sync_method`. This information can also be used to optimize the `commit_delay` parameter, which introduces a configurable delay before initiating a WAL flush.


## Options

The following command-line options are available:

**`-f`**<br />
**`--filename`**

Specifies the name of the file that is used to write test data. This file must reside on the same file system as the `pg_wal` directory, where WAL files are stored. By default, the file is named `pg_test_fsync.out` and is created in the current directory.

**`-s`**<br />
**`--secs-per-test`**

Sets the duration of each test in seconds. A longer duration increases the accuracy of the test but also extends the total run time. The default value is 5 seconds, allowing the program to complete in under 2 minutes.

**`-V`**<br />
**`--version`**

Prints the `pg_test_fsync` version, and exits.

**`-?`**<br />
**`--help`**

Shows help about `pg_test_fsync` command line arguments, and exits.


## Environment

**`PG_COLOR`**

Specifies whether to use color in diagnostic messages. Possible values are `always`, `auto`, and `never`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: pg_test_fsync
---

# pg_test_fsync

确定最快的将写前日志(WAL)更新强制写入磁盘的同步方法,即最快的 `wal_sync_method`。

## 语法概要

```shell
pg_test_fsync [<option> ...]

pg_test_fsync -? | --help

pg_test_fsync -V | --version
```

## 描述

`pg_test_fsync` 是一个标准的PostgreSQL工具,用于确定在你的系统上最快的 `wal_sync_method`。它还提供诊断信息,帮助排查已发现的 I/O 问题。然而,`pg_test_fsync` 报告的差异可能对实际数据库吞吐量影响不大,因为许多数据库服务器的性能并不受限于写前日志的速度。

`pg_test_fsync` 报告中包含了每种 `wal_sync_method` 的平均文件同步操作时间,单位为微秒。这些信息也可用于优化 `commit_delay` 参数的数值,用于配置启动WAL刷新之前的延迟时间。


## 选项

以下是可用的命令行选项:

**`-f`**<br />
**`--filename`**

指定用于写入测试数据的文件名。该文件必须位于与 `pg_wal` 目录,即存储WAL文件的目录,相同的文件系统中。默认情况下,文件名为 `pg_test_fsync.out`,并创建于当前目录中。

**`-s`**<br />
**`--secs-per-test`**

设置每个测试的持续时间,以秒为单位。更长的测试时间可以提高测试精度,但也会延长总运行时间。默认值为5秒,使程序能够在不到2分钟内完成。

**`-V`**<br />
**`--version`**

输出 `pg_test_fsync` 的版本号并退出。

**`-?`**<br />
**`--help`**

显示有关 `pg_test_fsync` 命令行参数的帮助信息,并退出。


## 环境变量

**`PG_COLOR`**

指定是否在诊断消息中使用颜色。可能的值为 `always`,`auto`,和 `never`。
1 change: 1 addition & 0 deletions sidebars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ const sidebars: SidebarsConfig = {
'sys-utilities/pg-dump',
'sys-utilities/pg-dumpall',
'sys-utilities/pg-filedump',
'sys-utilities/pg-test-fsync',
'sys-utilities/psql',
'sys-utilities/reindexdb',
'sys-utilities/vacuumdb',
Expand Down