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

Remove ORDER to make COUNT faster #365

Closed
wants to merge 1 commit into from
Closed

Conversation

joelvh
Copy link
Contributor

@joelvh joelvh commented Feb 12, 2020

@flash-gordon
Copy link
Member

I genuinely wonder which DBMS doesn't optimize it itself...

@solnic
Copy link
Member

solnic commented Feb 16, 2020

@flash-gordon are you saying we should make this optimization on a per-db type basis?

@flash-gordon
Copy link
Member

@solnic I'm saying that no DB doesn't do it by itself. Actually, using count with order by won't even work in PG, which means Sequel already ignores the ordering. This PR, however, reveals a bug in total because it uses unlimited datasets, which is plain wrong. If you want to paginate over a filtered relation, you'll get incorrect results. I'm amazed this hasn't been reported. I'll file an issue.

@joelvh
Copy link
Contributor Author

joelvh commented Feb 16, 2020

@flash-gordon nice catch #366

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

Successfully merging this pull request may close these issues.

3 participants