Using active_admin, I am witnessing slowness with respect to loading an index for a model that has many records. I am not sure that this related to the other reported cases of slowness.
2011-11-10 13:26:14 rails[35848] INFO: Started GET "/admin/articles" for 127.0.0.1 at Thu Nov 10 13:26:14 -0800 2011 2011-11-10 13:26:14 rails[35848] INFO: Processing by Admin::ArticlesController#index as HTML 2011-11-10 13:26:14 rails[35848] DEBUG: AdminUser Load (0.3ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 LIMIT 1 2011-11-10 13:26:14 rails[35848] DEBUG: Article Load (381.2ms) SELECT "articles".* FROM "articles" ORDER BY publish_date desc, guid desc, "articles".id desc LIMIT 30 OFFSET 0 2011-11-10 13:26:14 rails[35848] DEBUG: SQL (0.5ms) SELECT COUNT(*) FROM "articles" 2011-11-10 13:26:14 rails[35848] DEBUG: CACHE (0.0ms) SELECT COUNT(*) FROM "articles" 2011-11-10 13:26:14 rails[35848] DEBUG: CACHE (0.0ms) SELECT COUNT(*) FROM "articles" 2011-11-10 13:26:21 rails[35848] DEBUG: PendingArticle Load (6602.8ms) SELECT "pending_articles".* FROM "pending_articles" ORDER BY created_at desc 2011-11-10 13:26:41 rails[35848] DEBUG: Domain Load (1.0ms) SELECT "domains".* FROM "domains" 2011-11-10 13:26:41 rails[35848] INFO: Rendered /Users/sorens/.rvm/gems/ruby-1.8.7-p299@rails3/gems/activeadmin-0.3.4/app/views/active_admin/resource/index.html.arb (27605.5ms) 2011-11-10 13:26:41 rails[35848] INFO: Completed 200 OK in 27645ms (Views: 20629.0ms | ActiveRecord: 6985.8ms)
this was a request for /admin/articles. my article model has a belongs_to :pending_article. pending_article has has_one :article, :autosave => true.
I have a few questions
(1) Can I prevent this additional query? I am not accessing any field in any pending_article from the index view of article. it seems that the article query is correctly scoped by pagination but the follow-on query to pending_article appears to grab them all.
(2) why does the render of index.html.arb take 27+ seconds if it is just showing 30 records?
I am using Ruby 1.8.7-p299, Rails 3.0.5 and active_admin 0.3.4. The above output is from my development environment (it takes even longer on Heroku). In the above example, I had 10,708 articles and 17,648 pending_articles.