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

SqlCount #109

Open
dmfs opened this issue Oct 2, 2017 · 2 comments
Open

SqlCount #109

dmfs opened this issue Oct 2, 2017 · 2 comments

Comments

@dmfs
Copy link
Owner

dmfs commented Oct 2, 2017

If a ContentProvider uses an SQL backend, another method to get the row count of a table exists:

Cursor c = view.withProjection("Count(*)").rows(EmptyUriParams.INSTANCE, mPredicate, absent());
c.moveToFirst();
long count = c.getLong(0);

Of course that fails if a ContentProvider doesn't use an SQL backend. So the question is, is it worth it?
How much speed do we gain? We probably should test this with a reasonably large table first and compare it against #101.

@lemonboston
Copy link
Contributor

Just a question, do you expect RowCount/SqlCount to be used in production code, or only in tests?

@dmfs
Copy link
Owner Author

dmfs commented Oct 3, 2017

It's meant to be used in production code. For now this is very low priority though. RowCount will do well in most cases.

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

2 participants