8000 Backport Optimize count query for pagination_total: false option by mgrunberg · Pull Request #8470 · activeadmin/activeadmin · GitHub
[go: up one dir, main page]

Skip to content

Backport Optimize count query for pagination_total: false option #8470

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

Merged
merged 3 commits into from
Sep 4, 2024

Conversation

mgrunberg
Copy link
Contributor

Backport #6911

* Remove duplicated delegation

`total_pages` is listed twice.

* Remove ORDER BY from count subquery

Queries like `SELECT COUNT(*) FROM (SELECT DISTINCT resources.* FROM resources ORDER BY resources.created_at DESC LIMIT 1 OFFSET 30) subquery_for_count`
are too inefficient

* add specs about ensure count query does not include ORDER BY clause

* exclude also select because based on https://github.com/activeadmin/activeadmin/pull/7489\#issuecomment-1554197081

---------

Co-authored-by: Rafael Sales <rafaelcds@gmail.com>
Co-authored-by: David Rodríguez <deivid-rodriguez>
Co-authored-by: Matias Grunberg <matias@yellowspot.dev>
Copy link
codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (3-0-stable@276b0d4). Learn more about missing BASE report.

Additional details and impacted files
@@              Coverage Diff              @@
##             3-0-stable    #8470   +/-   ##
=============================================
  Coverage              ?   99.19%           
=============================================
  Files                 ?      194           
  Lines                 ?     4965           
  Branches              ?        0           
=============================================
  Hits                  ?     4925           
  Misses                ?       40           
  Partials              ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member
@javierjulio javierjulio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mgrunberg mgrunberg enabled auto-merge (squash) September 4, 2024 14:54
@mgrunberg mgrunberg merged commit c0cff8f into 3-0-stable Sep 4, 2024
19 checks passed
@mgrunberg mgrunberg deleted the backport-6911 branch September 4, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0