このセクションでは、OceanBaseクラスタのパフォーマンスメトリクスである SQL応答時間 について説明します。 SQL応答時間 メトリクスは、サーバーがSQLを処理する平均時間を集計するために使用されます。このメトリクスは、処理されるSQL文のタイプに基づいて、以下のサブメトリクスに細分化されています:all、select、insert、update、replace、delete、other。統計範囲を指定することで、単一ゾーンまたはOBServerノード上のOceanBaseクラスタの SQL応答時間 を照会できます。
all
指標の紹介
OceanBaseサーバーが各SQLステートメントを処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| all | sql_all_rt | μs |
計算式
(sum(rate(ob_sysstat{stat_id="40001",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40003",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40005",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40007",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40009",@LABELS}[@INTERVAL])) by (@GBLABELS) R_FILL_0_ADD sum(rate(ob_sysstat{stat_id="40019",@LABELS}[@INTERVAL])) by (@GBLABELS)) / (sum(rate(ob_sysstat{stat_id="40000",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40002",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40004",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40006",@LABELS}[@INTERVAL])) by (@GBLABELS) + sum(rate(ob_sysstat{stat_id="40008",@LABELS}[@INTERVAL])) by (@GBLABELS) R_FILL_0_ADD sum(rate(ob_sysstat{stat_id="40018",@LABELS}[@INTERVAL])) by (@GBLABELS))
SQL収集
OceanBase V4.0 より前のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40001, 40003, 40005, 40007, 40009, 40019, 40000, 40002, 40004, 40006, 40008, 40018) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0 以上のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40001, 40003, 40005, 40007, 40009, 40019, 40000, 40002, 40004, 40006, 40008, 40018) and (con_id > 1000 or con_id = 1) and class < 1000
select
指標の紹介
サーバーが各Selectステートメントを処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| select | sql_select_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40001",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40000",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0 より前のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40000, 40001) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0 以上のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40000, 40001) and (con_id > 1000 or con_id = 1) and class < 1000
insert
指標の紹介
サーバーが各INSERT文を処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| insert | sql_insert_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40003",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40002",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0 より前のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40002, 40003) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0 以降のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40002, 40003) and (con_id > 1000 or con_id = 1) and class < 1000
update
指標の紹介
サーバーが各UPDATE文を処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| update | sql_update_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40007",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40006",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0 より前のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40006, 40007) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0以降のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40006, 40007) and (con_id > 1000 or con_id = 1) and class < 1000
replace
指標の紹介
サーバーが各Replaceステートメントを処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| replace | sql_replace_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40005",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40004",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0未満のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40004, 40005) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0以降のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40004, 40005) and (con_id > 1000 or con_id = 1) and class < 1000
delete
指標の紹介
サーバーが各Deleteステートメントを処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| delete | sql_delete_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40009",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40008",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0未満のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40008, 40009) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0以降のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40008, 40009) and (con_id > 1000 or con_id = 1) and class < 1000
other
指標の紹介
サーバーが各DDL、DCL、DTLなどその他のステートメントを処理する平均時間です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| other | sql_other_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40019",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40000",@LABELS}[@INTERVAL])) by (@GBLABELS)
SQL収集
OceanBase V4.0未満のバージョン:
select /*+ MONITOR_AGENT READ_CONSISTENCY(WEAK) */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40000, 40019) and (con_id > 1000 or con_id = 1) and class < 1000OceanBase V4.0以降のバージョン:
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40000, 40019) and (con_id > 1000 or con_id = 1) and class < 1000
99-all
指標の紹介
SQLステートメントの平均処理時間TP99です。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| 99-all | sql_all_rt_tp99 | μs |
計算式
histogram_quantile(0.99, rate(ob_query_rt_cumulative_count{@LABELS}[@INTERVAL]))
SQL収集
OceanBase V4.2.1.7以降、V4.2.2.0未満のバージョン:
select t1.tenant_id, t1.svr_ip, t1.sql_type, (case when t1.response_time >= t0.max_rt then '+Inf' else t1.response_time * 1000000 end) as response_time, t1.total_count, t1.total_value * 1000000 as total_value, sum(t2.total_count) as cumulative_count, sum(t2.total_value) * 1000000 as cumulative_value from (select max(response_time) as max_rt from gv$ob_query_response_time_histogram) t0 join (select tenant_id, svr_ip, sql_type, response_time, sum(count) as total_count, sum(total) as total_value from gv$ob_query_response_time_histogram group by response_time, tenant_id, svr_ip, sql_type) t1 inner join (select tenant_id, svr_ip, sql_type, response_time, sum(count) as total_count, sum(total) as total_value from gv$ob_query_response_time_histogram group by response_time, tenant_id, svr_ip, sql_type) t2 on t1.response_time >= t2.response_time and t1.tenant_id = t2.tenant_id and t1.svr_ip = t2.svr_ip and t1.sql_type = t2.sql_type where t1.svr_ip = ? group by t1.response_time, t1.tenant_id, t1.sql_type
95-all
指標の紹介
SQLステートメントの平均処理時間TP95。
指標パラメータの説明
メトリクス項目 |
指標名 |
単位 |
|---|---|---|
| 95-all | sql_all_rt_tp95 | μs |
計算式
histogram_quantile(0.95, rate(ob_query_rt_cumulative_count{@LABELS}[@INTERVAL]))
SQLの収集
OceanBase V4.2.1.7以降、V4.2.2.0未満のバージョン:
select t1.tenant_id, t1.svr_ip, t1.sql_type, (case when t1.response_time >= t0.max_rt then '+Inf' else t1.response_time * 1000000 end) as response_time, t1.total_count, t1.total_value * 1000000 as total_value, sum(t2.total_count) as cumulative_count, sum(t2.total_value) * 1000000 as cumulative_value from (select max(response_time) as max_rt from gv$ob_query_response_time_histogram) t0 join (select tenant_id, svr_ip, sql_type, response_time, sum(count) as total_count, sum(total) as total_value from gv$ob_query_response_time_histogram group by response_time, tenant_id, svr_ip, sql_type) t1 inner join (select tenant_id, svr_ip, sql_type, response_time, sum(count) as total_count, sum(total) as total_value from gv$ob_query_response_time_histogram group by response_time, tenant_id, svr_ip, sql_type) t2 on t1.response_time >= t2.response_time and t1.tenant_id = t2.tenant_id and t1.svr_ip = t2.svr_ip and t1.sql_type = t2.sql_type where t1.svr_ip = ? group by t1.response_time, t1.tenant_id, t1.sql_type
commit
Commitステートメントの平均処理時間。
指標パラメータの説明
指標項目 |
指標名 |
単位 |
|---|---|---|
| commit | sql_commit_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40026",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40025",@LABELS}[@INTERVAL])) by (@GBLABELS)
収集SQL
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40025, 40026) and (con_id > 1000 or con_id = 1) and con_id in (select tenant_id from DBA_OB_TENANTS WHERE tenant_type<>'META')
rollback
Rollbackステートメントの平均処理時間。
指標パラメータの説明
指標項目 |
指標名 |
単位 |
|---|---|---|
| rollback | sql_rollback_rt | μs |
計算式
sum(rate(ob_sysstat{stat_id="40028",@LABELS}[@INTERVAL])) by (@GBLABELS) / sum(rate(ob_sysstat{stat_id="40027",@LABELS}[@INTERVAL])) by (@GBLABELS)
取得SQL
select /* MONITOR_AGENT */ con_id tenant_id, stat_id, value from v$sysstat where stat_id IN (40027, 40028) and (con_id > 1000 or con_id = 1) and con_id in (select tenant_id from DBA_OB_TENANTS WHERE tenant_type<>'META')