Oracle index and oracle index

Source: Internet
Author: User

Oracle index and oracle index

IndexIs a schema object that contains entries of each value. This entry appears in the index column of a table or cluster and provides direct and fast access to rows.

Create an index: create index name on table name (field name );

Delete index: drop index name

The purpose of index creation is to speed up the query. After the index is created, the DML operation efficiency is slow, but the query efficiency is improved. When you delete a table, the corresponding index is also deleted. In addition, indexes are sorted.

The index is created to reduce physical reads, which reduces the scanning time. The where clause field is frequently used, and the index should be used. In addition, the queried data and the percentage of all data must be viewed. The larger the table, the fewer query records, the efficiency of indexes is higher .;

 

Example:

Create index upper_ix ON employees (UPPER (last_name ));

Usage:

SELECT first_name, last_name FROM employees where upper (last_name) IS NOT NULLOrder by upper (last_name );

To increase the possibility of using indexes in Oracle databases rather than performing full table scans, make sure that the value returned by the function in subsequent queries is not empty. If there is no WHERE clause, the Oracle database may perform a full table scan.

 

Note:

The field condition after the WHERE clause must be consistent with the index, otherwise it may become invalid.

For example:Create index ix_birth mployees (birthday );

Query statement: select birthday from mployees where to_char (birthday, 'yyyy-mm') = '2017-01 ';

Result: The index has no effect.

 

Related Article

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.