OceanBase 計劃緩存視圖

2021-06-30 09:22 更新

計劃緩存視圖包含記錄執(zhí)行計劃的緩存狀態(tài)、執(zhí)行統(tǒng)計的相關(guān)信息以及計劃信息。

(g)v$plan_cache_stat

(g)v$plan_cache_stat 視圖用于記錄每個計劃緩存的狀態(tài),每個計劃緩存在該視圖中有一條記錄。

字段名稱

類型

描述

tenant_id

bigint(20)

租戶 ID

svr_ip

varchar(32)

IP 地址

svr_port

bigint(20)

端口號

sql_num

bigint(20)

plan_cache 涉及 SQL 條數(shù)

mem_used

bigint(20)

plan_cache 已經(jīng)使用的內(nèi)存

access_count

bigint(20)

進 plan_cache 的次數(shù)

hit_count

bigint(20)

命中 plan_cache 的次數(shù)

hit_rate

bigint(20)

命中 plan_cache 的次數(shù)

plan_num

bigint(20)

plan 的個數(shù)

mem_limit

bigint(20)

plan_cache 的內(nèi)存上限

hash_bucket

bigint(20)

plan_cache hash map 中的 bucket 的個數(shù)

stmtkey_num

bigint(20)

plan_cache 中 stmt_key 的個數(shù)

(g)v$plan_cache_plan_stat

(g)v$plan_cache_plan_stat 用于記錄計劃緩存中所有 plan 的具體信息及每個計劃總的執(zhí)行統(tǒng)計信息,每個 plan 在該視圖中有一條記錄。

字段名稱

類型

描述

tenant_id

bigint(20)

租戶 ID

svr_ip

varchar(32)

機器的 IP 地址

svr_port

bigint(20)

機器端口號

plan_id

bigint(20)

執(zhí)行計劃的 ID

sql_id

varchar(32)

這條 SQL 的 ID

type

bigint(20)

執(zhí)行計劃的類型:

  • 1 表示 local plan

  • 2 表示 remote plan

  • 3 表示 distribute plan

db_id

bigint(20) unsigned

database 的 ID

is_bind_sensitive

bigint(20)

該計劃是否需要打開 ACS

is_bind_aware

bigint(20)

該計劃已經(jīng)打開了 ACS

statement

varchar(4096)

參數(shù)化后的 SQL 語句

query_sql

varchar(65536)

第一次加載計劃時查詢的原始 SQL 語句

sys_vars

varchar(4096)

影響計劃的系統(tǒng)變量的值

plan_hash

bigint(20)

執(zhí)行計劃的 hash 值

first_load_time

timestamp(6)

第一次被加載時間

schema_version

bigint(20)

schema 版本號

merged_version

bigint(20)

當前緩存的 plan 對應(yīng)的合并版本號

last_active_time

timestamp(6)

上一次被執(zhí)行時間

avg_exe_usec

bigint(20)

平均執(zhí)行時間

slowest_exe_time

timestamp(6)

最慢一次執(zhí)行耗時

slowest_exe_usec

bigint(20)

最慢執(zhí)行時間戳

slow_count

bigint(20)

當前 plan 成為慢查詢次數(shù)

hit_count

bigint(20)

被命中次數(shù)

plan_size

bigint(20)

執(zhí)行計劃的大小

executions

bigint(20)

執(zhí)行次數(shù)

disk_reads

bigint(20)

所有執(zhí)行物理讀次數(shù)

direct_writes

bigint(20)

所有執(zhí)行寫盤的次數(shù)

buffer_gets

bigint(20)

所有執(zhí)行邏輯讀次數(shù)

application_wait_time

bigint(20) unsigned

所有執(zhí)行所有 application 類事件的總時間

concurrency_wait_time

bigint(20) unsigned

所有執(zhí)行所有 concurrency 類事件的總時間

user_io_wait_time

bigint(20) unsigned

所有執(zhí)行所有 user_io 類事件的總時間

rows_processed

bigint(20)

所有執(zhí)行選擇的結(jié)果行數(shù)或執(zhí)行更改表中的行數(shù)

elapsed_time

bigint(20) unsigned

所有執(zhí)行接收到請求到執(zhí)行結(jié)束消耗時間

cpu_time

bigint(20) unsigned

所有執(zhí)行消耗的 CPU 時間

large_querys

bigint(20)

被判斷為大查詢的次數(shù)

delayed_large_querys

bigint(20)

被判斷為大查詢且被丟入大查詢隊列的次數(shù)

outline_version

bigint(20)

outline 版本號

outline_id

bigint(20)

outline 的 ID。

如果為 -1 表示不是通過綁定 outline 生成的計劃

outline_data

varchar(65536)

計劃對應(yīng)的 outline 信息

acs_sel_info

varchar(65536)

當前 ACS 計劃對應(yīng)的選擇率空間

table_scan

tinyint(4)

表示該查詢是否為主鍵掃描

evolution

bool

表示該執(zhí)行計劃是否在演進中

evo_executions

bigint(20)

演進次數(shù)

evo_cpu_time

bigint(20) unsigned

演進過程中總的執(zhí)行 CPU 時間

timeout_count

bigint(20)

超時次數(shù)

ps_stmt_id

bigint(20)

prepare statement 的 ID

(g)v$plan_cache_plan_explain

(g)v$plan_cache_plan_explain 用于查詢某條 SQL 在計劃緩存中的執(zhí)行計劃。

注意 
如果查詢 gv$plan_cache_plan_explain 表, 則需要指定 IP、port、tenant_id、plan_id 等條件。
如果查詢 v$plan_cache_plan_explain 表, 則需要指定 tenant_id、plan_id 等條件。

字段名稱

類型

描述

TENANT_ID

bigint(20)

租戶 ID

IP

varchar(32)

IP 地址

PORT

bigint(20)

端口號

PLAN_ID

bigint(20)

執(zhí)行計劃的 ID

OPERATOR

varchar(128)

operator 的名稱

NAME

varchar(128)

表的名稱

ROWS

bigint(20)

預(yù)估的結(jié)果行數(shù)

COST

bigint(20)

預(yù)估的代價

PROPERTY

varchar(256)

對應(yīng) operator 的信息

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號