1、創建索引
create index 索引名 on 表名(列名);
2、刪除索引
drop index 索引名;
3、創建組合索引
create index 索引名 on 表名(列名1,,列名2);
4、查詢索引
--根據索引名,查詢表索引字段
select * from user_ind_columns where index_name='索引名';
--根據表名,查詢一張表的索引
select * from user_indexes where table_name='表名';
5、查詢數據庫中是否有失效的索引 【valid 表示索引有效,N/A表示分區索引,其餘標誌代表索引失效】
select index_name,status from user_indexes;
6、查詢指定索引是否失效 【valid 表示索引有效,N/A表示分區索引,其餘標誌代表索引失效】
select status from user_indexes where index_name='索引名'
7、查詢數據庫所有表中的數據量多少
select table_name,num_rows from user_tables;
8、查看錶的統計信息刷新時間(last_analyzed 爲刷新時間,表名需大寫)
select owner,table_name,status,last_analyzed from dba_tables where table_name = '表名';