达梦数据库、oracle数据库如何判断指定表有没有建立索引?对应的表有没有索引查询方法

sm_appmenuitem 这个演示表有 5 个索引。
我在不知道的情况下想知道这个表的索引有没有建成功,或者说我现在想知道这个表的索引有哪些,就要来查询了。
索引表查询方法如下,把对应的表放到括号里就能查出来了,达梦数据库和 oracle 数据库通用这个方法。

# 这两个方法都可以,属于全局级的表。
select * from user_indexes where table_name=upper('sm_appmenuitem'); 
select * from user_ind_columns where table_name = upper('sm_appmenuitem');

5 个索引相当于 5 的阶乘。现在查询时间 2 秒的话,如果没有索引,查询时间就是 25 次方秒 ≈ 32 秒,可见索引的重要性。
在这里插入图片描述
在这里插入图片描述
索引建表过程:

/* indexcode: i_sm_appmenuitem_1 */
create  index i_sm_appmenuitem_1 on sm_appmenuitem (pk_menuitem)
/

/* indexcode: i_sm_appmenuitem_2 */
create  index i_sm_appmenuitem_2 on sm_appmenuitem (menuitemcode)
/

/* indexcode: i_sm_appmenuitem_3 */
create  index i_sm_appmenuitem_3 on sm_appmenuitem (appid)
/

/* indexcode: i_sm_appmenuitem_4 */
create  index i_sm_appmenuitem_4 on sm_appmenuitem (appcode)
/

/* indexcode: i_sm_appmenuitem_5 */
create  index i_sm_appmenuitem_5 on sm_appmenuitem (menuitemname)
/

喜欢的点个赞❤吧!

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

挣扎的蓝藻

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值