oracle 索引使用

2021-06-18 19:15:54 字數 490 閱讀 3411

管理索引

單例索引:單例索引是基於單個列所建立的索引。

create index 索引名 on 表名(列名)

復合索引:復合索引是基於兩列或是多列建立的索引。

create index emp_idx1 on emp (ename,job);

creat index emp_idx1 on emp (job,ename);

顯示索引資訊

顯示表的所有索引:dba_indexs用於顯示資料庫所有的索引資訊,user_index用於顯示當前使用者的索引資訊。

select index_name,index_type  from user_indexes where table_name='表名';

顯示索引列: 查詢資料字段檢視user_ind_columns

select table_name,column_name from user_ind_columns where index_name='ind_ename';

oracle強制索引使用

強制索引格式 select tablename.from tablename table alias where fieldname 說明 index table alias indexname 必須出現在select 之後,字段之前 tablename 為表名,如果sql中表有別名,則必須使用表的...

Oracle索引的使用

最近做資料整合,把其他伺服器上的資料抽取到統一資料庫中,為提高速度,考慮採用索引。1.索引分類 a 唯一索引,作用是資料約束,保證資料唯一,還有就是資料索引,提高查詢效率 b 一般索引,只有資料索引的作用,2.唯一索引的建立 create unique index 索引名 on 表名 欄位名 ok,...

oracle的索引使用

最近工作要處理一批統計sql,過程中遇到一些問題,在此分享一下 oracle中最常用的索引就兩種 b樹索引和點陣圖索引,這裡就來簡單說下這兩種索引的使用。b 樹索引在 oracle 中是乙個通用的索引,在建立索引時它就是預設的索引型別。最多可以包括 32列。位圖索引 oracle 為每個唯一鍵建立乙...