Use explain to see what index is used. If no indexes exist, you should really make some :)
Mar 2, 2022
10
Level 1
Query Optimization
I run this query it't take 7-8 second there are more than 1 million data in cars and cars stocks
SELECT cars.id, cars.name, car_stocks.created_at FROM carsLEFT JOIN car_stocks ON car_stocks.car_id = cars.id and date(car_stocks.created_at) = '2022-01-18'
Please suggest if you have a more optimized/less time consuming query
Please or to participate in this conversation.
Child Table
Result with secound
Extra detail
