List:General Discussion« Previous MessageNext Message »
From:Michael Monashev Date:July 20 2005 1:04pm
Subject:random rows selection
View as plain text  
Hello,

How to select 5 random rows from big table with WHERE clause?

This query very slow on 1 mln rows:
SELECT col1, col2 FROM table WHERE col3=123 ORDER BY RAND() LIMIT 5

Have you a faster one?

Sincerely,
Michael,
 http://xoib.com/ http://3d2f.com/
 http://qaix.com/ http://ryxi.com/
 http://gyxe.com/ http://gyxu.com/
 http://xywe.com/ http://xyqe.com/


Thread
random rows selectionMichael Monashev20 Jul
  • Re: random rows selectionGleb Paharenko20 Jul
    • Re: random rows selectionMichael Monashev20 Jul
      • Re: random rows selectionGleb Paharenko21 Jul
  • Re: random rows selectionChris Knipe20 Jul
  • Re: random rows selectionNuno Pereira21 Jul