Oracle Index instances

Source: Internet
Author: User
An Oracle Index is an object in a relational database used to store each record location in a table. It aims to speed up Data Reading and integrity checks. Index

An Oracle Index is an object in a relational database used to store each record location in a table. It aims to speed up Data Reading and integrity checks. Index

An Oracle Index is an object in a relational database used to store each record location in a table. It aims to speed up Data Reading and integrity checks. Indexing is a highly technical task.

Generally, we need to consider how to design and create indexes in the database design stage.

1. Create an index

Syntax for creating an index:

CREATE [UNIQUE] INDEX [schema.] index
ON [schema.] table (column [ASC | DESC], column [ASC | DESC]...)
[CLUSTER schema. cluster]
[INITRANS n]
[MAXTRANS n]
[PCTFREE n]
[STORAGE storage]
[TABLESPACE tablespace]
[No sort]

Keyword description:

Example: create a product table (tb_product) and create an index for the product_id column of the Table to improve the query efficiency when using this column.

Create table tb_product
(
Product_id number
, Product_name varchar2 (100)
, Product_type varchar2 (20)
, Product_unit varchar2 (50)
, Product_unit_price number (10, 4)
);

The following code creates a unique index on the product_id column:

Create unique index product_id_u1 on tb_product (product_id );

2. Modify the index

The modification of indexes is mainly done by the database administrator. Modifying indexes involves modifying the storage parameters of indexes, re-indexing, and merging useless index spaces.

Modify the index Syntax:

ALTER [UNIQUE] INDEX [user.] index
INITRANS n
MAXTRANS n
REBUILD
[STORAGE ]

Note:

Example:

Use the alter index statement to modify the INDEX parameters:

Alter index product_id_u1 rebuild storage (INITIAL 1 m next 512 K );

Use the alter index statement to change the INDEX to a reverse INDEX:

Alter index product_id_u1 rebuild reverse;

Use the alter index statement to merge the INDEX space:

Alter index product_id_u1 COALESCE;

3. delete an index

You can use the DROP statement to delete an index.

Drop index schema. index;

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

Sharing pool for Oracle Performance Optimization

Author: David contact: david.louis.tian@outlook.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.