Home > Database > Mysql Tutorial > body text

Performance comparison of Oracle using indexes and not using indexes

不言
Release: 2018-10-11 15:01:49
forward
2610 people have browsed it

The content of this article is about the performance comparison of Oracle using indexes and not using indexes. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

First prepare a table with millions of data, so that the analysis of data gaps is more vivid!

The following uses paging table data to analyze the table, sort according to the EMP_ID field, and find out the performance gap between using indexes 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 <= 20)
 WHERE ROWNUM_ >= 10;
Copy after login

Use explain plan for can 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 <= 20)
 WHERE ROWNUM_ >= 10;
Copy after login

to calculate SQL performance, use

select * from TABLE(dbms_xplan.display);打印出性能分析表
Copy after login

as shown below:

Before using index:

After using index

You can clearly see that the cpu usage is very low after using it, and the retrieval starts from the index instead of the full text Search

The above is the detailed content of Performance comparison of Oracle using indexes and not using indexes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!