Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an option to NOT show a count for a given scope. #804

Closed
MrJoy opened this issue Dec 2, 2011 · 9 comments
Closed

Add an option to NOT show a count for a given scope. #804

MrJoy opened this issue Dec 2, 2011 · 9 comments

Comments

@MrJoy
Copy link

MrJoy commented Dec 2, 2011

Not all scopes are cheap to compute a count for, even if they are useful to expose in the admin UI.

A configuration option that allows us to disable the count for a given scope would be enormously useful.

@nevir
Copy link
Contributor

nevir commented Feb 5, 2012

+1 This is an enormous slowdown (minutes per request) for large tables.

@MrJoy
Copy link
Author

MrJoy commented Feb 14, 2012

Partial progress on this, as there's now an option on index to control whether scopes are counted or not, but no love on per-scope configuration it seems.

@latortuga
Copy link
Contributor

Good news @MrJoy I have a fix written for this that will let you exclude counts on a per-scope basis like so:

scope :all, :show_count => false # defaults to true

@hakanensari
Copy link
Contributor

@MrJoy @latortuga Are you by any chance on PostgreSQL?

Also: It feels disabling the scope counter only alleviates the problem, as the paginator at the bottom of the list still counts?

@MrJoy
Copy link
Author

MrJoy commented Jun 11, 2012

No, not on PostgreSQL. The problem was that some scopes represent complicated queries that aren't well indexed (or cannot be well indexed due to limitations in MySQL's ability to execute certain complex queries). The scopes are still useful to us, but we don't want to be running them ALL THE TIME.

The paginator behavior is not a big enough issue to diminish the importance of the requested (and thankfully implemented!) feature.

The problem was that we might have 10 scopes that each take 10 seconds to do a count on. The list view when no scopes are applied, and no scopes are defined in ActiveAdmin is plenty fast despite pagination being a bit expensive for some tables -- but when adding a scope to ActiveAdmin adds 10 seconds of overhead to any view of the list page for a model, then the scopes feature becomes quite useless.

Thus, turning off counters was absolutely necessary to make ActiveAdmin's scope feature usable to us.

That said, non-counted pagination as an option would be great too for a number of our tables, but that's a much lower priority.

@sadfuzzy
Copy link

Thanks!

@knagode
Copy link

knagode commented Nov 20, 2018

Any progress here? Would love this feature as well ..

@javierjulio
Copy link
Member

@knagode what exactly is missing? You can disable scope count per scope and also disable the pagination total count.

@knagode
Copy link

knagode commented Nov 20, 2018

@javierjulio Nice. I see that show_count option was actually merged into master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants