aurora_stat_plans - Amazon Aurora

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

aurora_stat_plans

傳回每個追蹤執行計畫的列。

語法

aurora_stat_plans( showtext )

引數

  • showtext – 顯示查詢和計劃文字。有效值為 NULL、 true 或 false。True 會顯示查詢和計劃文字。

傳回類型

傳回每個追蹤計畫的資料列,其中包含來自 的所有資料欄aurora_stat_statements和下列額外資料欄。

  • planid – 計劃識別符

  • explain_plan – 說明計畫文字

  • plan_type:

    • no plan - 未擷取任何計劃

    • estimate - 以預估成本擷取的計劃

    • actual - 使用 EXPLAIN ANALYZE 擷取的計劃

  • plan_captured_time – 上次擷取計劃的時間

使用須知

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 版和所有其他更新版本取得。

範例

在下面的範例中,會擷取查詢識別符 -5471422286312252535 的兩個計劃,且由平面追蹤陳述式統計資料。

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)