I have an SQL query that needs to be optimized for speed.
The SQL query currently takes about 0.33 seconds to execute. I am sure it can be significantly improved as I am new to SQL. I need someone who can optimize this query for the best speed:
SELECT qty_available, date_added FROM inventory_available WHERE dealer_id = 342547821 AND inventory_id = 4937432 AND sub_dealer_id = 83567218 AND location = 'subdealer' AND warehouse_id=0 AND consignee_id = 0 ORDER BY date_added DESC, id DESC LIMIT 1
The winner of the bid should be able to explain to me how they optimized it so I can learn from it :)