Login | Register | Recent |
 
 

Optimizing MySQL Rand() against Slowdowns

 

70
Hits
Rand() function works well in pulling out rows randomly from the datbase and works well if you have a quite few hundred records. Ironically, it desperately slows down when you have a large table dataset above 10,000 rows. Instead of making mysql generate random, you generate a random value with php and then pull that random value from the table. Make sure you have ID in your table as auto-incremented one.

Posted on: 2008-01-08 09:21:25 by pbu
Website: corpocrat.com
Category: Articles

Tags: mysql rand slow

Visit Site

 

Tag Cloud

mysql rand slow mysql rand function slow connect mysql php optimize mysql php php paging mysql mysql code generator mysql query optimization store images mysql