3

The beginning of my ActiveAdmin rails log for a query looks like this:

Started GET "/things" for 127.0.0.1 at 2015-12-17 15:43:30 -0500
Processing by ThingsController#index as HTML
AdminUser Load (57.1ms)  SELECT  `admin_users`.* FROM `admin_users` WHERE `admin_users`.`id` = 1  ORDER BY `admin_users`.`id` ASC LIMIT 1
(58.1ms)  SELECT COUNT(count_column) FROM (SELECT  1 AS count_column FROM `things` WHERE `things`.`retired_at` IS NULL AND `things`.`errored_at` IS NULL LIMIT 30 OFFSET 0) subquery_for_count
CACHE (0.0ms)  SELECT COUNT(count_column) FROM (SELECT  1 AS count_column FROM `things` WHERE `things`.`retired_at` IS NULL AND `things`.`errored_at` IS NULL LIMIT 30 OFFSET 0) subquery_for_count
CACHE (0.0ms)  SELECT COUNT(count_column) FROM (SELECT  1 AS count_column FROM `things` WHERE `things`.`retired_at` IS NULL AND `things`.`errored_at` IS NULL LIMIT 30 OFFSET 0) subquery_for_count
CACHE (0.0ms)  SELECT COUNT(count_column) FROM (SELECT  1 AS count_column FROM `things` WHERE `things`.`retired_at` IS NULL AND `things`.`errored_at` IS NULL LIMIT 30 OFFSET 0) subquery_for_count

What are the mechanisms and files in ActiveAdmin or its dependencies that are generating the 58.1ms SELECT COUNT ... subquery_for_count?

1 Answers1

1

You can refer the following URL: documentation

That count query can be reduced with following:

index pagination_total: false do
    # ...
end

Hope this helps you.

Swati Yamgar
  • 139
  • 1
  • 14