rails-data-explorer icon indicating copy to clipboard operation
rails-data-explorer copied to clipboard

Add sampling for large ActiveRecord tables

Open jhund opened this issue 10 years ago • 1 comments

So that we can handle more than 100K records. Suggestions for sampling ActiveRecord are welcome.

jhund avatar Feb 11 '15 00:02 jhund

Some resources that may be helpful (in no particular order):

  • http://blog.rhodiumtoad.org.uk/2009/03/08/selecting-random-rows-from-a-table/
  • https://www.periscope.io/blog/how-to-sample-rows-in-sql-273x-faster.html
  • http://stackoverflow.com/a/8675160/130830
  • http://www.depesz.com/2007/09/16/my-thoughts-on-getting-random-row/ references
    • http://web.archive.org/web/20080214234949/http://people.planetpostgresql.org/greg/index.php?/archives/40-Getting-random-rows-from-a-database-table.html
    • http://web.archive.org/web/20080214235745/http://www.powerpostgresql.com/Random_Aggregate

The solutions work best with minimal gaps on a numeric primary key.

jhund avatar Feb 17 '15 03:02 jhund