Query statistic is taking 99% of the query time
问题 I have an SQL query which take about 1.81s seconds to execute. I profiled it in phpMyAdmin and I saw that 99% of the time is spend on 'statistics'. Interestingly if I add one more join, the time goes up to about 23 seconds and if I remove 1 join the time goes down to about 0.26 seconds. I have tried to put the product_id = in the where the the attribute_id = in the join. It does not improve the performance and the 'statistics' still use 99% of the time. I have tried group by p.id which does