Home > Backend Development > PHP Tutorial > Problems with select count(*) query optimization and index building when there is multiple data

Problems with select count(*) query optimization and index building when there is multiple data

WBOY
Release: 2016-08-18 09:15:52
Original
1226 people have browsed it

InnoDB table type, select count(*) where condition is followed by 12 query values, and it takes about 5 seconds to query 500,000 pieces of data without indexing. I would like to ask if building an index column is the best solution for this situation. By the way, is the consumption of an index column and an index equal? ​​For example, it affects the efficiency of additions, deletions, and modifications, space size, etc. Thank you

Reply content:

InnoDB table type, select count(*) where condition is followed by 12 query values, and it takes about 5 seconds to query 500,000 pieces of data without indexing. I would like to ask if building an index column is the best solution for this situation. By the way, is the consumption of an index column and an index equal? ​​For example, it affects the efficiency of additions, deletions, and modifications, space size, etc. Thank you

500,000 in 5 seconds is too slow. . You need to build a joint index based on your query conditions

Please post the query statement as well

source:php.cn
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