Selectcount (*) query to optimize index creation when multiple data items exist

Source: Internet
Author: User
The table type of InnoDB. the selectcount (*) where condition is followed by 12 query values. If no index is added, it takes about 5 seconds to query 0.5 million data records, is it the best solution to create an index column in this case? by the way, is the consumption of an index column equal to that of an index, for example, the impact on growth... the table type of InnoDB. The select count (*) where condition is followed by 12 query values. If no index is added, it takes about 5 seconds to query 0.5 million data records, is it the best solution to create an index column in this case? by the way, is the consumption of an index column equal to that of an index, such as the efficiency of adding, deleting, and modifying indexes and the size of space. Thank you.

Reply content:

The table type of InnoDB. The select count (*) where condition is followed by 12 query values. If no index is added, it takes about 5 seconds to query 0.5 million data records, is it the best solution to create an index column in this case? by the way, is the consumption of an index column equal to that of an index, such as the efficiency of adding, deleting, and modifying indexes and the size of space. Thank you.

0.5 million 5 seconds is too slow .. You need to create a joint index based on your query conditions.

Paste the query statement.

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.