using index
SQL> create table cus(id int primary key,name varchar2(10));
表已建立。
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='CUS';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
SYS_C005215 P CUS TEST SYS_C005215
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='CUS';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- --------------------
SYS_C005215 NORMAL CUS UNIQUE TEST
SQL> create table xx(a int,constraint xx primary key(a));
表已建立。
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='XX';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
XX P XX TEST XX
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='XX';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- ------------------
XX NORMAL XX UNIQUE TEST
create table order_item
(order_id number(3),
item_id number(2),
qty number(4),
constraint ord_itm_id_pk
primary key(order_id,item_id)
using index
(create index ord_itm_idx
on order_item(order_id,item_id)))
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='ORDER_ITEM';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
ORD_ITM_ID_PK P ORDER_ITEM TEST ORD_ITM_IDX
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='ORDER_ITEM';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- ------------------------------
ORD_ITM_IDX NORMAL ORDER_ITEM NONUNIQUE TEST
表已建立。
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='CUS';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
SYS_C005215 P CUS TEST SYS_C005215
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='CUS';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- --------------------
SYS_C005215 NORMAL CUS UNIQUE TEST
SQL> create table xx(a int,constraint xx primary key(a));
表已建立。
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='XX';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
XX P XX TEST XX
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='XX';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- ------------------
XX NORMAL XX UNIQUE TEST
create table order_item
(order_id number(3),
item_id number(2),
qty number(4),
constraint ord_itm_id_pk
primary key(order_id,item_id)
using index
(create index ord_itm_idx
on order_item(order_id,item_id)))
SQL> select constraint_name,constraint_type,table_name,index_owner,index_name from user_constraints where table_name='ORDER_ITEM';
CONSTRAINT_NAME C TABLE_NAME INDEX_OWNER INDEX_NAME
------------------------------ - ------------------------------ ------------------------------ ------------------------------
ORD_ITM_ID_PK P ORDER_ITEM TEST ORD_ITM_IDX
SQL> select index_name,index_type,table_name,uniqueness,tablespace_name from user_indexes where table_name='ORDER_ITEM';
INDEX_NAME INDEX_TYPE TABLE_NAME UNIQUENES TABLESPACE_NAME
------------------------------ --------------------------- ------------------------------ --------- ------------------------------
ORD_ITM_IDX NORMAL ORDER_ITEM NONUNIQUE TEST
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26937943/viewspace-1270318/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Using index condition Using indexIndex
- MySQL explain結果Extra中"Using Index"與"Using where; Using index"區別MySqlAIIndex
- alter table using indexIndex
- MYSQL中的type:index 和 Extra:Using indexMySqlIndex
- How to Find Out How Much Space an Index is UsingIndex
- best practice of rebuild your partition table local index online by using: "update indexes"RebuildIndex
- KEEP INDEX | DROP INDEXIndex
- rowid,index,INDEX FULL SCAN,INDEX FAST FULL SCAN|IndexAST
- INDEX UNIQUE SCAN,INDEX FULL SCAN和INDEX FAST FULL SCANIndexAST
- Clustered Index Scan and Clustered Index SeekIndex
- oracle hint之full,index,index_asc,index_desc,index_combile示例OracleIndex
- IndexIndex
- Index的掃描方式:index full scan/index fast full scanIndexAST
- rebuild index 和 recreate index (重新建立index) 的區別RebuildIndex
- MySQL 索引優化 Using where, Using filesortMySql索引優化
- pk 、unique index 和 index 區別Index
- global index & local index的區別Index
- alter index rebuild與index_statsIndexRebuild
- B-index、bitmap-index、text-index使用場景詳解Index
- Index Full Scan vs Index Fast Full ScanIndexAST
- 【Oracle】global index & local index的區別OracleIndex
- Index Full Scans和Index Fast Full ScansIndexAST
- What is meant by Primary Index and Secondary IndexIndex
- Index Full Scan 與 Index Fast Full ScanIndexAST
- PostgreSQL:INDEXSQLIndex
- <MYSQL Index>MySqlIndex
- jQuery index()jQueryIndex
- index索引Index索引
- rebuild indexRebuildIndex
- index rebuildIndexRebuild
- Bitmap IndexIndex
- index range scan,index fast full scan,index skip scan發生的條件IndexAST
- Using hints for PostgresqlSQL
- MySQL 之 USINGMySql
- Using the WITH CHECK OPTION
- CQRS using phpPHP
- create index/create index online區別Index
- Create index with open on-line index creationIndex