---
title: PDML SQL 性能问题排查-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于 PDML SQL 性能问题排查相关的常见问题和使用技巧，帮助您快速解决 PDML SQL 性能问题排查的难题。
image: https://mdn.alipayobjects.com/huamei_22khvb/afts/img/A*OSPzQ6GUQF4AAAAAQHAAAAgAeiGDAQ/original
---
切换语言

- 中文站 - 简体中文
- International - English
- 日本站 - 日本語

划线反馈

# PDML SQL 性能问题排查

更新时间：2026-05-15 09:06

适用版本： V3.1.x、V3.2.x 内容类型：Troubleshoot  

## 问题描述

PDML SQL 长时间执行跑不出结果，需要排查执行情况。

## 适用版本

OceanBase 数据库 V3.x 版本。

## 问题原因

OceanBase 数据库执行 PDML SQL 消耗系统资源。

## 解决方法

1. 登录 sys 租户。
 2. 步骤一查询内部表查看当前执行 PDML 线程情况。

   ```shell
   obclient > select * from __all_virtual_px_worker_stat;

   ```
 3. 将步骤二获得的 trace id 值带入以下 SQL 中。

   ```shell
   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 信息。
 4. 结合 `__all_virtual_processlist` 表中当前 session 记录里的 `retry_info` 和 `retry_count` 判断。
 5. 若存在大量的重试，需要调大租户 `undo_retention` 变量。

上一篇

[OceanBase 数据库 V3.x 简单 SQL 查询添加 Timestamp 后性能显著下降的原因及解决方法](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000002571413)

下一篇

[关于集群隐藏参数 _enable_new_sql_nio 的说明](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000000207685) ![有帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*y6ocSqN8cqsAAAAAAAAAAAAAARQnAQ)![无帮助](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*BG9IQJyLHF8AAAAAAAAAAAAAARQnAQ)![反馈](https://gw.alipayobjects.com/mdn/ob_asset/afts/img/A*eTWdQKCRKHwAAAAAAAAAAAAAARQnAQ)[AI](https://www.oceanbase.com/obi) 咨询热线
