---
title: 执行命令 show create table xx 不显示表的索引相关信息的原因和解决方法-OceanBase数据库使用指南
description: 了解OceanBase数据库在实际应用中关于执行命令 show create table xx 不显示表的索引相关信息的原因和解决方法相关的常见问题和使用技巧，帮助您快速解决执行命令 show create table xx 不显示表的索引相关信息的原因和解决方法的难题。
---
切换语言

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

划线反馈

# 执行命令 show create table xx 不显示表的索引相关信息的原因和解决方法

更新时间：2026-05-22 08:56

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

## 问题现象

执行命令 `show create table` 没有显示索引信息，但是 `show index from` 可以索引信息。

![image01](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20250725executing-command-show-create-table-xx-does-not-display-index-related-information-table01.png)

![image02](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20250725executing-command-show-create-table-xx-does-not-display-index-related-information-table02.png)

## 关键诊断信息

- 是否做过 OMS 迁移？
 - 当前 `_show_ddl_in_compat_mode` 是否打开？
 - 表上的索引类型？

## 问题原因

OMS 在迁移的时候，将原来的 `local index` 改成 `global index`，此为 OMS BUG。 MySQL 没有 GLOBAL 索引，所以开启 `_show_ddl_in_compat_mode` 后 `show create table` 不显示全局索引。 可以通过下面的语句，验证索引的类型，其中 `index_type = 8` 代表 `global index`。

```shell
select tenant_id, table_name as index_name, data_table_id as table_id, index_type from oceanbase.__all_virtual_table where table_name like '%uniq_order_role';

```

![image03](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20250725executing-command-show-create-table-xx-does-not-display-index-related-information-table03.png)

OceanBase 数据库 MySQL 模式下 `show create table` 语法不完全兼容 MySQL 语句，导致在 OMS 迁移过程中，大部分 `Binlog` 增量解析系统初始化失败使用 Binlog 。为了严格兼容 MySQL 的 `show create table`，OceanBase 提供了参数 `_show_ddl_in_compat_mode`，该值默认是关闭的，当打开的时候，可以完全兼容 MySQL show create table 语句。

当关闭 `_show_ddl_in_compat_mode` 后，可以 `global index` 可以正常显示。

![image04](https://obbusiness-private.oss-cn-shanghai.aliyuncs.com/doc/img/knowledge-base/database/sql/20250725executing-command-show-create-table-xx-does-not-display-index-related-information-table04.png)

## 问题的风险及影响

索引不显示。

## 适用版本

OceanBase 数据库 V3.x、V4.x 版本。

## 解决方法

当关闭 `_show_ddl_in_compat_mode` 后，可以 `global index` 可以正常显示。

## 规避方式

当关闭 `_show_ddl_in_compat_mode` 后，可以 `global index` 可以正常显示。

```shell
set _show_ddl_in_compat_mode = 0;

```

上一篇

[SQL 在各个节点间流量/CPU 分布不均匀](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000005428828)

下一篇

[如何查看索引表占用磁盘空间的大小](https://www.oceanbase.com/knowledge-base/oceanbase-database-1000000002398588) ![有帮助](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) 咨询热线
