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

Each query seems to execute a count() ? #93

Closed
srtonz opened this issue Jun 21, 2017 · 4 comments
Closed

Each query seems to execute a count() ? #93

srtonz opened this issue Jun 21, 2017 · 4 comments

Comments

@srtonz
Copy link

srtonz commented Jun 21, 2017

I noticed the following behavior when querying a simple model. Any idea why the count query is executed? When running the same query through a plain cassandra.cqlengine.models.Model outside of Django, I don't see the count query

x = list(Data.objects.filter(col5='27'))
[2017-06-21 14:04:41,692] [cassandra.cqlengine.connection] [DEBUG] [Connection: DEFAULT_CONNECTION] SELECT "col1", "col2", "col3", "col4" FROM fx.data WHERE "col5" = %(0)s LIMIT 10000 ALLOW FILTERING (pid: 6998)
[2017-06-21 14:04:42,872] [cassandra.cqlengine.connection] [DEBUG] [Connection: DEFAULT_CONNECTION] SELECT COUNT(*) FROM fx.data WHERE "col5" = %(0)s LIMIT 10000 ALLOW FILTERING (pid: 6998)
@srtonz
Copy link
Author

srtonz commented Jun 21, 2017

I think this is because the _count attribute is reset here:

Not quite sure why that's happening instead of caching the queryset's count() result?

@srtonz
Copy link
Author

srtonz commented Jul 13, 2017

Any ideas?

@r4fek r4fek closed this as completed in f5792bf Jul 18, 2017
@r4fek
Copy link
Owner

r4fek commented Jul 18, 2017

Hey @geotob!

Sorry for the delay, I didn't have time to look into it.
Could you try with current master now?

@srtonz
Copy link
Author

srtonz commented Aug 2, 2017

Hey @r4fek This works now, thanks a lot! 👍

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