0.01
No commit activity in last 3 years
No release in over 3 years
Disable active admin count queries for selected tables
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

 Project Readme

Don't you count

ActiveAdmin is a great way to boostrap a good looking and customizable admin interface in no time. However there are some performance issues related to using it.

What is it about?

When displaying the index view AA automatically issues a SELECT COUNT(*) SQL query in order to enable pagination. As long as you have no more than couple thousand records in your db it is instant. However once your collections start getting bigger this single query could timeout your server. And this is no good. Setting:

    index pagination_total: false do 

does not prevent the count query.

How to use ?

Gemfile

gem 'dont_you_count' # below activeadmin gem

config/initializers/active_admin.rb

ActiveAdmin.setup do |config|
  config.dont_count = ['product', 'order']
end

That's it. The count query will no longer be issued for product and order models. The total count will be set to 2 million. I don't know if it is the best idea but works for my case. It breaks the last pagination button but it is better then breaking the servers. PRs are welcome.

Compatibility

Tested to work with activeadmin (1.0.0.pre) and kaminari (0.16.1). Let me know if you notice any problems with other versions.

The newest version of AA has the issue resolved according to this.