Oracle Indexes Index

Source: Internet
Author: User
Tags create index

An index is a schema object that contains an entry for each value that appears in the Index column of a table or cluster and provides direct, quick access to the row.

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

DROP INDEX: Dropping index name

The purpose of indexing is to speed up queries, and indexing will make DML operations slow, but will improve efficiency for user queries. When you delete a table, the corresponding index is also deleted. In addition, the indexes are sorted.

The index is created to reduce physical reads, and the index reduces the time to scan. In the fields that often use the WHERE clause, the index should be used, as well as the percentage of the data being queried and the total data, the larger the table, the fewer records are queried, and the more efficient the index is.

Example:

CREATE INDEX Upper_ix on Employees (upper (last_name));

Use:

SELECT first_name, last_name from Employees WHERE UPPER (last_name) are not NULL for ORDER by UPPER (last_name);

to increase the likelihood that an Oracle database uses an index instead of performing a full table scan, ensure that the value returned by the function in subsequent queries is not NULL. If there is no WHERE clause, the Oracle database may perform a full table scan.

Precautions:

The field condition after the where should be consistent with the index, otherwise it may fail.

such as: CREATE INDEX ix_birth mployees (birthday);

Query statement: Select Birthday from mployees where To_char (birthday, ' yyyy-mm ') = ' 2018-01 ';

Result: Index has no effect

Oracle Indexes Index

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.