title: Sorting records quickly from a model with 500k records
body: <p>I am attempting to sort records in a model which has 500k rows in it.  When I initially attempted this procedure I had just 200 records and used the following code and pulled out records 1-5 to list those that were most popular:</p>
  
  <p><code>@mostpopular = Product.find(:all, :order =&gt; 'click_count DESC')</code></p>
  
  <p>However, now I have a far larger dataset, this grinds my computer to a halt and I am looking to try to complete the search in a more efficient manner.</p>
  
  <p>I have tried adjusting the code to <code>@mostpopular = Product.order('click_count DESC').limit(10)</code> but this still take a LONG time to complete...</p>
  
  <p>Is there a more efficient way to pull out the top 10 most popular records from a large dataset?</p>
  
  <p>Thanks for your time</p>