Oracle之查询对应索引的情况
来源:互联网 发布:网络教育的英语作文 编辑:程序博客网 时间:2024/05/19 04:50
SET LINESIZE 666
set pagesize 5000
column index_name format a30
column table_name format a26
column num_rows format 999999999
column index_type format a24
column num_rows format 999999999
column status format a8
column clustering_factor format 999999999
column degree format a10
column blevel format 9
column distinct_keys format 9999999999
column leaf_blocks format 9999999
column last_analyzed format a10
column column_name format a25
column column_position format 9
column temporary format a2
column partitioned format a5
column partitioning_type format a7
column partition_count format 999
--.查看索引情况
--1. 每张表对应有多少个索引,物理多大
select t2.table_name,t1.segment_name,sum(t1.bytes)/1024/1024
from user_segments t1,user_indexes t2
where t1.segment_name=t2.index_name
and t1.segment_type like '%INDEX%'
and t2.table_name in ('T1',
'T2')
group by t2.table_name,t1.segment_name
order by table_name;
--2. 结构情况(索引类型、高度、重复度、并行度、叶子高度、聚合因子、记录数、状态、最近分析时间。。。)
/*
通过index_type可以方便的得知索引类型,普通索引(NORMAL)?位图索引(BITMAP)?函数索引(FUNCTION-BASED NORMAL)?反向键索引NORMAL/REV?
通过status字段可知是否是分区索引(N/A)
通过status字段可知普通索引是否失效(VALID/UNUSABLE)
通过degree字段可得是否有被设置为并行度的属性(值大于1)
通过观察last_analyzed字段值可知是否有正常收集,看有无值,或者是看时间是否很久以前的。
*/
select t.table_name,
t.index_name,
t.num_rows,
t.index_type,
t.status,
t.clustering_factor,
t.blevel,
t.distinct_keys,
t.leaf_blocks,
t.uniqueness,
t.degree,
t.last_analyzed
from user_indexes t
where table_name in ('T1','T2');
--3. 查看索引列信息(在表的哪一列有索引,或者是在哪几个列有联合索引,普通表和分区表都一样)
select t.table_name,t.index_name, t.column_name, t.column_position, t.DESCEND
from user_ind_columns t
where table_name in ('T1',
'T2')
order by table_name,index_name, column_position;
--4. 分区索引总的信息(不会展示各分区上的各分区索引信息,总的描述了分区索引的类型及分区总数)
select table_name,index_name, partitioning_type, partition_count
from user_part_indexes
where table_name in ('T1',
'T2')
order by table_name,index_name;
----分区索引详细信息(每个分区的索引都展示,详细说明了各分区索引的状态、表空间位置、收集状态情况....)
select index_name,
partition_name,
status,
num_rows,
blevel,
leaf_blocks,
last_analyzed,
tablespace_name
from user_ind_partitions
where index_name in
(select index_name
from user_indexes
where table_name in ('T1', 'T2'));
阅读全文
0 0
- Oracle之查询对应索引的情况
- oracle数据库查询Sql语句是否使用索引及常见的索引失效的情况
- Oracle模糊查询之(5.1认识全文索引之什么是分词[lexer])oracle Text 全文检索功能对中文分词的支持情况
- oracle,查询分区表和非分区表,索引对应的表空间sql
- 查询sqlserver 索引的使用情况
- 查询时索引失效的情况
- SQL查询索引失效的情况
- oracle介绍之oracle不走索引的7种常见情况!
- oracle介绍之oracle不走索引的7种常见情况!
- Oracle模糊查询之(5.4认识全文索引之全文索引的原理二)Oracle 全文索引[主文]
- 监控Oracle索引的使用情况
- Oracle 索引无法使用的情况
- oracle 索引失效的情况分析
- oracle 查询表对应的 sequnece
- 查询oracle srid 对应的EPSG代码
- oracle查询当前用户的连接情况
- Oracle 查询DB的负载情况
- Oracle数据库--表锁的情况查询
- 王思聪“包养”电竞后 万达觉得可以开攻游戏行业了
- Ubuntu Unity 已死,但 Ubuntu 在云端依然受欢迎
- 最美曲面屏手机 vivo Xplay6 面纱下全是黑科技
- Lyft获5亿美元融资,能否狙击丑闻缠身的Uber?
- Netty入门二 之解编码
- Oracle之查询对应索引的情况
- 安卓UI控件-ViewAnimator及其子类
- 类的私有变量
- TensorFlow自定义损失函数
- 苹果推出视频制作应用Clips,人工智能特性是亮点
- 任正非讲话回应华为“清理34岁员工”传闻,并称要有称霸世界的雄心
- 周鸿祎:通用型的人工智能都是骗子,必须结合垂直领域
- 环保部与腾讯达成战略合作 探索互联网+环保新模式
- 今日头条翻了24倍的估值 开始切割谁的蛋糕