Inefficient query After partitioning of large data volumes in oracle

Source: Internet
Author: User

Scenario Description: There are two tables in the oracle database, one of which is tm_bus_realtime_log. The current table only contains data from the previous day. The data volume has millions of data records. There is also a table where the History Table tm_bus_realtime_his is partitioned. Every 10 days, there are three partitions each month. The entire history table contains hundreds of millions of data records. Each partition has tens of millions of data records. Problem description: it is slow to query data from a partition of a history table. Because of the large data volume, if you want to query data for several days, it is slower? How can I increase the query speed? I posted a post on this topic on the forum. I am very grateful to those who have made comments. Some good suggestions are as follows: 1. Change to one partition per day and 2. Clean up historical data, for example, you can only store data for 2 years. 3. Check if the index is created based on the plan. 4. If there are other fields in your query condition except time, create a local index. 5 if the historical table data is not changed, you can create a trunc (XX) bitmap function index in the time field and specify the partition during query. 6. Table partitions. The index partition 7 depends on the where condition. Some of my practices: In fact, I want to create two interfaces to query and display the required comprehensive information, which has a large amount of data. Partition. However, when the data is displayed in the query, the data of the day can still be queried, but the query speed is particularly slow after the cross-partition operation. 1. For the current table tm_bus_realtime_log. Check its index. There is only one (index name: INDEX_BUS_REALTIME field name: UPLOAD_TIME). In my query SQL, there are two fields, bus_no and upload_tiime, the index field should be followed by the where condition. 2. Do not use * For the queried data. It is best to use a specific field. 3. Press F5 in plsql to view the execution plan of the SQL statement, whether it is a full table scan or an index. 4 indexes are not suitable for creating many indexes. If more indexes are created, query efficiency may be affected. At that time, a useless redundant index was deleted. The speed is faster. 5. Try not to use in. Use exists.6 to optimize the code. Now the data is much faster!
 

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.