Easy to ignore in Oracle

Source: Internet
Author: User
When we write SQL statements, we often ignore some details. The following is a summary of my own operations and materials. If there is something wrong, or there is a supplement.

When we write SQL statements, we often ignore some details. The following is a summary of my own operations and materials. If there is something wrong, or there is a supplement.

When we write SQL statements, we often ignore some details. The following is a summary of my own operations and materials. If there is something wrong or something wrong, hope to reply to me and learn from each other. Thank you!

1. When a full table scan is performed, and the number of records in the full table scan is more than 100, you need to create a correspondingIndexOrChange query ConditionsTo use index queries to avoid full table scans.

2. Use the like statement in the query as much as possible.Suffix fuzzy search. For example:
Select * from tablename where column_name like'% Name %'-- The index on column_name is not used



Select * from tablename where column_name like' Name %' -- Use the index on column_name



3. If the subquery or list after in contains more than five values, do not use in instead of exists; use not exists instead of not in.

4. Do not select useless fields.

For more information about Oracle, see the Oracle topic page? Tid = 12

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.