indexing is not working properly after upgrade mysql 8.0.28

  Kiến thức lập trình

The issue is coming after up gradation of mysql 8.0.28. I have a table called user_products. When I run the EXPLAIN SELECT query on it, the possible keys identified are user_id, productId, status, product_to, and product_multicol. The key is productId, with a key length of 4.

The query itself is:

    SELECT user_products.id,user_products.status,user_products.delivery_date,user_products.product_to,user_products.category_id,users.username,user_groups.name FROM user_products 
LEFT JOIN category ON category.id = user_products.category_id
LEFT JOIN users ON user_products.user_id = users.id
LEFT JOIN user_groups ON user_groups.id = users.user_group_id
WHERE user_products.status = 0 AND user_products.product_to = "10" AND user_products.delivery_date <= CURDATE() 
ORDER BY user_products.id DESC

For user_products.product_to = “49”, the query takes approximately 5 seconds to execute. However, for other values of product_to, it only takes 0.007 seconds.

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT