joickle Posted March 14, 2008 Share Posted March 14, 2008 Hello, I am working on a site where I need to pull about 3000 random lines from a database but I've read that using ORDER BY Rand() is a bad idea for large databases. Any ideas as to the best way to do this? Thanks, Jason Quote Link to comment Share on other sites More sharing options...
unsider Posted March 14, 2008 Share Posted March 14, 2008 Does it really matter, by random I'm guessing you wouldn't know the output anyway so would you be fine with a mathematical extraction? Example: every odd, every other odd, etc... That's the only other possible solution I know of. How large is this database exactly? I'd just google search some possible alternatives. or mysql.com? Quote Link to comment Share on other sites More sharing options...
joickle Posted March 14, 2008 Author Share Posted March 14, 2008 I expect the database to grow to 50,000 or more lines. Jason Quote Link to comment Share on other sites More sharing options...
soycharliente Posted March 14, 2008 Share Posted March 14, 2008 Read this. It has multiple other ways of doing what you're looking for. Maybe one of them will suit your fancy. http://akinas.com/pages/en/blog/mysql_random_row/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.