Home > Article > Backend Development > Problems with select count(*) query optimization and index building when there is multiple data
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
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