I have a large table in the database with offers (over 300,000 rows).
when I execute the following query, it takes 3 seconds.
$sql = "SELECT * FROM `offers` WHERE (`start_price` / `price` >= 2) ORDER BY RAND() LIMIT 1";
Table offers
`id` int(11) NOT NULL,
`title` text NOT NULL,
`description` text NOT NULL,
`image` text NOT NULL,
`price` float NOT NULL,
`start_price` float NOT NULL,
`brand` text NOT NULL
Is there any way to do this faster? I want to select one random line ( start_price/ price> = 2)
source
share