title: MYSQL: Query order by rand() very slow
body: <p>I have to pick 30 random records from a table, except that the query uses one second, and this slows mysql if the content is displayed by many users.
  This is the query:</p>
  
  <pre><code>SELECT relationship, COUNT(id) AS number FROM FR_user_friends GROUP BY relationship ORDER BY rand() LIMIT 30
  </code></pre>
  
  <p>Do you know how to speed up this query? Thank you.</p>
  
  <p>If I remove rand() the query is fast. We have to find an alternative for rand()</p>