rails-data-explorer
rails-data-explorer copied to clipboard
Add sampling for large ActiveRecord tables
So that we can handle more than 100K records. Suggestions for sampling ActiveRecord are welcome.
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.