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

MongodbQuery#list() is calling cursor.size() which is an additional mongo query #856

Closed
spasam opened this issue Jul 17, 2014 · 2 comments
Closed
Milestone

Comments

@spasam
Copy link

@spasam spasam commented Jul 17, 2014

MongodbQuery#list() is calling cursor.size() which is an additional mongo count query. It looks like this is used in couple of places in this file. cursor.size() seems to be used to construct exact size ArrayList. I think the count query can be more expensive than re-sizing the ArrayList.

https://github.com/querydsl/querydsl/blob/master/querydsl-mongodb/src/main/java/com/mysema/query/mongodb/MongodbQuery.java#L271

@timowest
Copy link
Member

@timowest timowest commented Jul 17, 2014

Thanks for this observation. I took a look at other options to get the count before creating the ArrayList, but couldn't find suitable ones, so I will provide a pull request with a no-args constructor.

@timowest timowest added the fixed label Jul 17, 2014
@timowest timowest modified the milestone: 3.4.2 Jul 17, 2014
@timowest timowest removed the fixed label Jul 19, 2014
@timowest timowest closed this Jul 19, 2014
@timowest
Copy link
Member

@timowest timowest commented Jul 29, 2014

Released in 3.4.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.