Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The difference between using indexes and not using indexes in oracle

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you the difference between using an index and not using an index in oracle. I hope you will gain a lot after reading this article. Let's discuss it together.

First of all, prepare a table with millions of pieces of data, so that it is more vivid to analyze the data gap!

The following is to analyze the table with paged table data, sort according to the EMP_ID field, and the performance gap between using and not using indexes!

Sql query syntax preparation. Specific business writes sql syntax according to specific tables:

SELECT * FROM (SELECT ROW_.*, ROWNUM ROWNUM_ FROM (SELECT * FROM KQS_SQ_INFO i ORDER BY i.EMP_ID desc) ROW_ WHERE ROWNUM = 10

Use explain plan for to analyze sql

As follows:

Explain plan for SELECT * FROM (SELECT ROW_.*, ROWNUM ROWNUM_ FROM (SELECT * FROM KQS_SQ_INFO i ORDER BY i.EMP_ID desc) ROW_ WHERE ROWNUM = 10

Calculate the SQL performance using the

Select * from TABLE (dbms_xplan.display); print out the performance analysis table

As shown below:

Before using the index:

After using the index

You can clearly see that the utilization rate of cpu is very low after use, and the retrieval starts from the index rather than full-text retrieval.

After reading this article, I believe you have a certain understanding of the difference between using an index and not using an index in oracle. If you want to know more about it, welcome to follow the industry information channel. Thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report