

# aurora\$1stat\$1plans
<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\$1plan — 계획 텍스트 설명
+ plan\$1type:
  + `no plan` - 계획이 캡처되지 않음
  + `estimate` - 예상 비용을 포함하여 캡처된 계획
  + `actual` - EXPLAIN ANALYZE로 캡처된 계획
+ plan\$1captured\$1time - 계획이 마지막으로 캡처된 시간

## 사용 노트
<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에 대한 두 개의 계획이 캡처되고 해당 문 통계는 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)
```