基于湖库一体架构,统一管理结构化、半结构化与非结构化等多模态数据,一个系统承载事务处理、实时分析与 AI 工作负载。
PDML SQL 性能问题排查
更新时间:2026-05-15 09:06
问题描述
PDML SQL 长时间执行跑不出结果,需要排查执行情况。
适用版本
OceanBase 数据库 V3.x 版本。
问题原因
OceanBase 数据库执行 PDML SQL 消耗系统资源。
解决方法
登录 sys 租户。
步骤一查询内部表查看当前执行 PDML 线程情况。
obclient > select * from __all_virtual_px_worker_stat;将步骤二获得的 trace id 值带入以下 SQL 中。
obclient > select op_id, op, rows, rescan, threads, (close_time - open_time) open_dt, (last_row_eof_time-first_row_time) row_dt, open_time, close_time, first_row_time, last_row_eof_time FROM (select plan_line_id op_id, concat(lpad('', plan_depth, ' '), plan_operation) op, sum(output_rows) rows, sum(STARTS) rescan, min(first_refresh_time) open_time, max(last_refresh_time) close_time, min(first_change_time) first_row_time, max(last_change_time) last_row_eof_time, count(1) threads from oceanbase.gv$sql_plan_monitor where trace_id = 'Yxxxxxxxxx' group by plan_line_id, plan_operation order by plan_line_id)a;说明
上述 SQL 代码为 OBServer 慢查询的 Plan 层面的统计,慢查询统计信息,同时记录该 Plan 的 Trace 信息。
结合
__all_virtual_processlist表中当前 session 记录里的retry_info和retry_count判断。若存在大量的重试,需要调大租户
undo_retention变量。