A simple example of creating an index for an Oracle data table

Source: Internet
Author: User

WhenOracle data tableWhen there are many records, in order to improve the query efficiency, we oftenCreate an indexIn this way, the query speed can be greatly improved during the query. This article introduces the process of creating an index in the form of an instance. Next let's take a look at this process.

First, check the existing indexes.

 
 
  1. select index_name from all_indexes where table_name = ‘PICTURE’; 

Sure enough, the system only built the index for the primary key: SYS_C55001

An error is also made. In general, oracle is case-insensitive, but table_name in the preceding query statement must be in uppercase. If it is written as 'picture ', there is no record.

Again, create an index.

 
 
  1. create index picture_album_idx on picture aid);  
  2.  
  3. create index picture_user_idx on picture userid);  
  4.  
  5. create index picture_cat_idx on picture cid); 

Third, repeat the first step to verify whether the operation is successful.

Fourth, let's see if the speed is faster when you browse the album.

In theory, it should be faster.

 
 
  1. select index_name from all_indexes where table_name = ‘TB_PUT_APPROVE’;  
  2.  
  3. select * from TB_PUT_APPROVE t  
  4.  
  5. create index TB_PUT_APPROVE_approveid on TB_PUT_APPROVEapproveid) 

This article introduces how to create an index for an Oracle data table. I hope this article will help you with some benefits. Thank you!

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.