<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 08:57:54 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[JAVA-2713] Reduce memory usage of QueryResult</title>
                <link>https://jira.mongodb.org/browse/JAVA-2713</link>
                <project id="10006" key="JAVA">Java Driver</project>
                    <description>&lt;p&gt;QueryResult uses a list to store items, which results in excessive memory usage and unnecessary CPU load.&lt;/p&gt;

&lt;p&gt;Indeed, the MongoIterable API is streaming oriented with the functions forEach and iterator, it does not require the use of a list in the background.&lt;/p&gt;

&lt;p&gt;In addition, this prevents the use of reusable objects in a ThreadLocal to limit the creation of these and further improve the memory footprint.&lt;/p&gt;</description>
                <environment></environment>
        <key id="474614">JAVA-2713</key>
            <summary>Reduce memory usage of QueryResult</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="13202">Works as Designed</resolution>
                                        <assignee username="ross@mongodb.com">Ross Lawley</assignee>
                                    <reporter username="vgilles">Vincent GILLES</reporter>
                        <labels>
                    </labels>
                <created>Wed, 20 Dec 2017 08:14:22 +0000</created>
                <updated>Fri, 27 Oct 2023 13:21:09 +0000</updated>
                            <resolved>Wed, 20 Dec 2017 09:20:35 +0000</resolved>
                                    <version>3.6.0</version>
                                                    <component>Internal</component>
                    <component>Performance</component>
                                        <votes>0</votes>
                                    <watches>2</watches>
                                                                                                                <comments>
                            <comment id="1756560" author="ross@10gen.com" created="Wed, 20 Dec 2017 09:20:35 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=vgilles&quot; class=&quot;user-hover&quot; rel=&quot;vgilles&quot;&gt;vgilles&lt;/a&gt;,&lt;/p&gt;

&lt;p&gt;Thanks for the ticket. The reason a QueryResult has to be backed by a list is because of how MongoDB works. When running a query, MongoDB executes the query and returns the first batch of results, along with the cursor id. As the cursor (MongoIterable) is iterated, the driver calls for the next batch in the results from MongoDB via the &lt;a href=&quot;https://docs.mongodb.com/manual/reference/command/getMore/#dbcmd.getMore&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;getMore command&lt;/a&gt;. The QueryResult class is just a container for a batch of results from MongoDB.&lt;/p&gt;

&lt;p&gt;As you mention the MongoIterable interface provides some functional methods that aim to add flexibility in consuming the data, however, they just encapsulate how the underlying iterator is consumed.&lt;/p&gt;

&lt;p&gt;Because of the batching nature of a MongoDB cursor, I&apos;m closing this ticket as &quot;Works as Designed&quot;.&lt;/p&gt;

&lt;p&gt;All the best,&lt;/p&gt;

&lt;p&gt;Ross&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hte70n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>