Two indexing methods (important)

Source: Internet
Author: User

① Automatic index creation:When
UniqueAndPK
The index is automatically created.

② Manually create an index:

create index emp_ename_index on emp(ename);

Which columns are suitable for indexing:

① Columns frequently appear in the WHERE clause.

② Columns frequently used for table join.

③ This column contains many null values.

④ The table is large, but the query result set is small.

⑤ PK column and unique column.

Column 6 FK.

7.
Columns that require sorting and grouping.

The significance of indexing is to improve the query efficiency.

Note: indexes are not omnipotent.

Which columns are not suitable for indexing:

① The table is small.

② Columns rarely appear in the WHERE clause.

③ The query result set is large.

④ This column is updated frequently.

Which write methods will cause index unavailability:

① The function causes indexing to fail.

Where upper (first_name) = 'Tom;

② The expression causes index unavailability

Where Sal * 12 = 18000;

③ Some implicit data types make indexes unusable

Where c1 = 2 (C1 is varchar2 );

④ Like

Where first_name like 'Ca % ';

⑤ The index cannot be used due to the negative form

Where first_name <> 'Tom ';

Where Sal not between 1000 and 2000;

Where deptno not in (10, 20, 30 );

⑥ Is null, leading to index unavailability

Where comm is null;




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.