

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# aurora\$1stat\$1database
<a name="aurora_stat_database"></a>

它攜帶 pg\$1stat\$1database 的所有欄，並在結尾加上新欄。

## 語法
<a name="aurora_stat_database-syntax"></a>

 

```
aurora_stat_database()
```

## 引數
<a name="aurora_stat_database-arguments"></a>

無

## 傳回類型
<a name="aurora_stat_database-return-type"></a>

SETOF 記錄包含所有 `pg_stat_database` 欄和以下附加欄。如需 `pg_stat_database` 欄的詳細資訊，請參閱 [https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW](https://www.postgresql.org/docs/current/monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW)。
+ `storage_blks_read` - 從此資料庫中 Aurora 儲存體讀取的共用區塊總數。
+ `orcache_blks_hit` - 此資料庫中最佳化讀取快取命中的總數。
+ `local_blks_read` - 在此資料庫中讀取的本機區塊總數。
+ `storage_blk_read_time` - 如果啟用 `track_io_timing`，它會追蹤從 Aurora 儲存讀取資料檔案區塊所花費的總時間 (以毫秒為單位)，否則值為零。如需詳細資訊，請參閱 [track\$1io\$1timing](https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-TRACK-IO-TIMING)。
+ `local_blk_read_time` - 如果啟用 `track_io_timing`，它會追蹤讀取本機資料檔案區塊所花費的總時間 (以毫秒為單位)，否則值為零。如需詳細資訊，請參閱 [track\$1io\$1timing](https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-TRACK-IO-TIMING)。
+ `orcache_blk_read_time` - 如果啟用 `track_io_timing`，它會追蹤從最佳化讀取快取中讀取資料檔案區塊所花費的總時間 (以毫秒為單位)，否則值為零。如需詳細資訊，請參閱 [track\$1io\$1timing](https://www.postgresql.org/docs/current/runtime-config-statistics.html#GUC-TRACK-IO-TIMING)。

**注意**  
`blks_read` 的值是 `storage_blks_read`、`orcache_blks_hit` 和 `local_blks_read` 的總和。  
`blk_read_time` 的值是 `storage_blk_read_time`、`orcache_blk_read_time` 和 `local_blk_read_time` 的總和。

## 使用須知
<a name="aurora_stat_database-usage-notes"></a>

此函數適用於下列 Aurora PostgreSQL 版本：
+ 15.4 版和更新的 15 版本
+ 14.9 版和更新的 14 版本

## 範例
<a name="aurora_stat_database-examples"></a>

以下範例顯示它如何攜帶所有 `pg_stat_database` 欄並在結尾附加 6 個新欄：

```
=> select * from aurora_stat_database() where datid=14717;    
-[ RECORD 1 ]------------+------------------------------
datid                    | 14717
datname                  | postgres
numbackends              | 1
xact_commit              | 223
xact_rollback            | 4
blks_read                | 1059
blks_hit                 | 11456
tup_returned             | 27746
tup_fetched              | 5220
tup_inserted             | 165
tup_updated              | 42
tup_deleted              | 91
conflicts                | 0
temp_files               | 0
temp_bytes               | 0
deadlocks                | 0
checksum_failures        |
checksum_last_failure    |
blk_read_time            | 3358.689
blk_write_time           | 0
session_time             | 1076007.997
active_time              | 3684.371
idle_in_transaction_time | 0
sessions                 | 10
sessions_abandoned       | 0
sessions_fatal           | 0
sessions_killed          | 0
stats_reset              | 2023-01-12 20:15:17.370601+00
orcache_blks_hit         | 425
orcache_blk_read_time    | 89.934
storage_blks_read        | 623
storage_blk_read_time    | 3254.914
local_blks_read          | 0
local_blk_read_time      | 0
```