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

PERF: PaginateAsync uses Count(*) to count number of rows #682

Closed
binoypatel opened this issue Jul 14, 2023 · 2 comments
Closed

PERF: PaginateAsync uses Count(*) to count number of rows #682

binoypatel opened this issue Jul 14, 2023 · 2 comments

Comments

@binoypatel
Copy link

Hi there,

Thanks for your great work. I am new to this library and using it first time in my project. I found that when I am using the following code:
var result = await _db.Query("Customers")
.OrderBy("Id")
.Select("Id", "Name", "Tag")
.PaginateAsync(
1,
10
)
.ConfigureAwait(false);

In the log, I can see that it uses
SELECT COUNT(*) AS [count] FROM [Customers]

Would it be possible to change to COUNT(1) instead of COUNT(*)?

Kind regards,
Binoy

@nielslucas
Copy link

nielslucas commented Jul 23, 2023

Why would you need this? I did a 1 minute research (sorry, too lazy to do more) and found this:

https://stackoverflow.com/questions/1221559/count-vs-count1-sql-server

The answere: There is no difference.

For the record, not trying to attack you, just curious for the 'why'. Its always a good practise to supply a 'why' to a feature request.

@binoypatel
Copy link
Author

binoypatel commented Jul 23, 2023 via email

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

No branches or pull requests

3 participants