[Oracle]-[Index]: check data before creating an index, or create an index before inserting data.

Source: Internet
Author: User

[Oracle]-[Index]: check data before creating an index, or create an index before inserting data. Problem: 1. Create a new table structure and create an index, import millions or tens of millions of data into the table using insert. 2. Create a new table structure, use isnert to import millions or tens of millions of data into the table, and then create an index. Which of the two is more efficient? Or is it short? I feel that no matter whether you create an index first or later, you need to update the index data when you have data. The problem is that if you have an index, You need to insert data and create an index when you have data. Experiment: 1.3 records, 1. Create a table and an index first, and then insert data, about minutes. 2. Insert data first and then create two indexes. create table xxx as select * from t where 1 <> 1; about 13 seconds, create two indexes for about 26 seconds and 35 seconds. Conclusion: If you create an index before inserting data, you need to modify the index information each time you insert data. The actual situation depends on the business requirements. Some businesses may also require indexes and constraints to verify the data. In this way, you should first create an index. For one-time processing, insert data first and then create an 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.