Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What generates the first ActiveAdmin COUNT query?

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?

like image 454
Aaron Boyer Avatar asked Apr 25 '26 15:04

Aaron Boyer


1 Answers

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.

like image 111
Swati Yamgar Avatar answered Apr 28 '26 06:04

Swati Yamgar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!