My table tbltemp
has around 9 lakhs records. The columns are: id
(primary key, autoincrement), name
, qty
, price
, status
, mod_date
, created_date
.
My query is:
SELECT *
FROM tbltemp
WHERE qty > 3
ORDER By Rand()
LIMIT 50
It takes around 7 to 10 seconds to execute. How can I optimize my table or query?