Mysql order by operation performance problems

Source: Internet
Author: User


Mysql order by operation performance problems in my notebook, run the following SQL code (a total of about 70 thousand rows of data, no index) select * from (SELECT nodeinfo. nodeID nodeid, nodeinfo. niid, nodeinfo. type, nodeinfo. testType testtype, sensordatapacket. storedtime, sensordatapacket. value, sensordatapacket. unit, sensordatapacket. dataType datatype, nodeconfig. nodeAddress nodename FROM www.2cto.com nodeinfo Left Join sensordatapacket ON nodeinfo. nodeID = Sensordatapacket. nodeID Left Join nodeconfig ON nodeconfig. nodeID = nodeinfo. nodeID where testtype = 'test' and type = 'soil temperature 'order by storedtime desc) a group by. nodeid order by. storedtime desc: red-letter annotation. When order by storedtime desc is used, the total time is 9.284 s. When order by storedtime asc is used, the total time is 2.022 s when the 172.164s operation is not used. For each nodeid, the most recent data record of storedtime is retrieved. If the order by operation is not used, the data is retrieved. The storedtime is a certain time in the middle. In line with the database relational model theory proposed by Dr. E. F. Codd in "a relation modal of data for large shared data banks. The physical storage of a database is not necessarily stored in the primary key sequence. The data in a data table is essentially in a collection.
 

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.