What would be faster?
// OPTION 1:
SELECT id, title, type, source
FROM ads_banners
WHERE live = 1
AND ads_zones_id = 1
AND id >= (SELECT FLOOR(MAX(id) * RAND())
FROM ads_banners
WHERE live = 1
AND ads_zones_id = 1)
ORDER BY id
LIMIT 1
// OPTION 2:
SELECT id, title, type, source
FROM ads_banners
WHERE live = 1
AND ads_zones_id = 1
ORDER BY RAND()
LIMIT 1
Subject
Written By
Posted
What would be faster?
July 23, 2007 05:44AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.