

# aurora\_stat\_plans
<a name="aurora_stat_plans"></a>

追跡されたすべての実行計画の行を返します。

## 構文
<a name="aurora_stat_plans-syntax"></a>

 

```
aurora_stat_plans(
    showtext
)
```

## 引数
<a name="aurora_stat_plans-arguments"></a>
+ showtext – クエリと計画のテキストを表示します。有効な値は、NULL、true または false です。True はクエリと計画のテキストを表示します。

## 戻り型
<a name="aurora_stat_plans-return-type"></a>

`aurora_stat_statements` からのすべての列とそれに続く追加の列を含む追跡計画ごとに行を返します。
+ planid - 計画識別子
+ explain\_plan – 計画の説明テキスト
+ plan\_type:
  + `no plan` - 計画はキャプチャされませんでした
  + `estimate` - 推定コストでキャプチャされた計画
  + `actual` - EXPLAIN ANALYZE でキャプチャされた計画
+ plan\_captured\_time – 計画が最後にキャプチャされた時刻

## 使用に関する注意事項
<a name="aurora_stat_plans-usage-notes"></a>

追跡する計画については、`aurora_compute_plan_id` が有効で、`pg_stat_statements` が `shared_preload_libraries` 内にある必要があります。

使用可能な計画の数は、`pg_stat_statements.max` パラメータで設定された値によって制御されます。`aurora_compute_plan_id` を有効にすると、`aurora_stat_plans` でこの指定された値までの計画を追跡できます。

この関数は、Aurora PostgreSQL バージョン 14.10、15.5、およびそれ以降のすべてのバージョンで使用できます。

## 例
<a name="aurora_stat_plans-examples"></a>

以下の例では、クエリ識別子 -5471422286312252535 の 2 つの計画がキャプチャされ、ステートメントの統計が planid によって追跡されます。

```
db1=# select calls, total_exec_time, planid, plan_captured_time, explain_plan
db1-# from aurora_stat_plans(true)
db1-# where queryid = '-5471422286312252535'   

calls    |  total_exec_time   |   planid    |      plan_captured_time       |                           explain_plan                           
---------+--------------------+-------------+-------------------------------+------------------------------------------------------------------
 1532632 |  3209846.097107853 |  1602979607 | 2023-10-31 03:27:16.925497+00 | Update on pgbench_branches                                      +
         |                    |             |                               |   ->  Bitmap Heap Scan on pgbench_branches                      +
         |                    |             |                               |         Recheck Cond: (bid = 76)                                +
         |                    |             |                               |         ->  Bitmap Index Scan on pgbench_branches_pkey          +
         |                    |             |                               |               Index Cond: (bid = 76)
   61365 | 124078.18012200127 | -2054628807 | 2023-10-31 03:20:09.85429+00  | Update on pgbench_branches                                      +
         |                    |             |                               |   ->  Index Scan using pgbench_branches_pkey on pgbench_branches+
         |                    |             |                               |         Index Cond: (bid = 17)
```