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

Optimization of sql statement in ORACLE

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

Today is the last day of April, and tomorrow is the holiday!~ Three days! I hope I can make use of these days to make up my professional knowledge. I will start learning SQL optimization courses tonight!

routine optimization

1: Try to avoid listing all columns with *, because it takes time for the system to parse * into columns, which makes SQL slower.

2: TRUNCATE instead of Delete; when the data is determined not to, TRUNCATE instead of Delete will be faster, he will not talk about data into the undo table space, of course, TRUNCATE can not use rollback recovery.

TRUNCATE TABLE TABLE_NAME DROP STORAGE;

3: In the case of ensuring integrity, multi-use COMMIT, timely release of resources, you can release: rollback segment data, locks obtained by program statements, redo log buffer space, ORACLE internal expenses for managing the above resources

4: Minimize the number of queries to tables

5: Substitute EXISTS for IN

In subqueries, the in clause performs an internal sort and merge, resulting in inefficiency

Table join optimization

1: Selection of driver table

The first table accessed (full scan access), usually followed by a full scan.

2: where the order of the word connection

Joints between tables are written at the front, filtered at the end of maximum offload

Reasonable use of index

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