<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 03:25:26 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>[SERVER-11307] Large $or clauses are extremely slow when compared to other access methods</title>
                <link>https://jira.mongodb.org/browse/SERVER-11307</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I was building a joining utility, in order to retrieve subdocuments, I built a query of or clauses matching each sub document to retrieve. The results were not terribly surprising at first, the query was very slow to respond.&lt;/p&gt;

&lt;p&gt;What was surprising was when I began to page my actual queries, that is to say divide the entries in the $or clause into many separate db queries matching 50 of the joining documents at a time, the database began responding much much faster.&lt;/p&gt;

&lt;p&gt;A join query for 1000 document took a minute without paging. With a small page size of 5 documents per join query, that time went down to 177ms.&lt;/p&gt;

&lt;p&gt;Querying for one document at a time was still at 214ms, way faster than where I started.&lt;/p&gt;

&lt;p&gt;So what I mean to say is that I think there is something wrong with the $or clause if it basically takes longer to execute a single query rather that 1000 small queries.&lt;/p&gt;

&lt;p&gt;Perhaps there is a limitation I&apos;m not aware and that&apos;s why I marked this as an improvement and not a bug&lt;/p&gt;

&lt;p&gt;Here are the results of my testing&lt;br/&gt;
Documents    Page Size	    Total Time (ms)&lt;br/&gt;
1000	      200	            1236&lt;br/&gt;
1000	      100	            733&lt;br/&gt;
1000	      50	            407&lt;br/&gt;
1000	      25	            271&lt;br/&gt;
1000	      10	            192&lt;br/&gt;
1000	      5	            177&lt;br/&gt;
1000	      1	            214&lt;/p&gt;

&lt;p&gt;10000	      1000	            59929&lt;br/&gt;
10000	      500	            30566&lt;br/&gt;
10000	      200	            12918&lt;br/&gt;
10000	      100	            6708&lt;br/&gt;
10000	      50	            4082&lt;br/&gt;
10000	      25	            2804&lt;br/&gt;
10000	      10	            1892&lt;br/&gt;
10000	      5	            1696&lt;br/&gt;
10000	      1	            2550&lt;/p&gt;</description>
                <environment>nodejs driver</environment>
        <key id="95292">SERVER-11307</key>
            <summary>Large $or clauses are extremely slow when compared to other access methods</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="9">Done</resolution>
                                        <assignee username="ramon.fernandez@mongodb.com">Ramon Fernandez Marina</assignee>
                                    <reporter username="khous">Kyle Housley</reporter>
                        <labels>
                            <label>query</label>
                    </labels>
                <created>Tue, 22 Oct 2013 20:00:06 +0000</created>
                <updated>Wed, 10 Dec 2014 23:18:48 +0000</updated>
                            <resolved>Mon, 14 Jul 2014 21:00:27 +0000</resolved>
                                    <version>2.5.3</version>
                                                    <component>Querying</component>
                                        <votes>0</votes>
                                    <watches>5</watches>
                                                                                                                <comments>
                            <comment id="658526" author="ramon.fernandez" created="Mon, 14 Jul 2014 21:00:14 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=khous&quot; class=&quot;user-hover&quot; rel=&quot;khous&quot;&gt;khous&lt;/a&gt;, we haven&apos;t heard back from you for a while, so we&apos;re going to mark this ticket as resolved. If this is still an issue for you, feel free to re-open and provide additional information.&lt;/p&gt;

&lt;p&gt;Regards,&lt;br/&gt;
Ram&#243;n.&lt;/p&gt;</comment>
                            <comment id="647415" author="ramon.fernandez" created="Thu, 3 Jul 2014 15:13:30 +0000"  >&lt;p&gt;Hi &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=khous&quot; class=&quot;user-hover&quot; rel=&quot;khous&quot;&gt;khous&lt;/a&gt;, is this still an issue for you? If you&apos;ve upgraded to older versions and you&apos;re still seeing slow &lt;tt&gt;$or&lt;/tt&gt; queries, could you please let us know? If the behavior you describe wasn&apos;t fixed in 2.5.5 we would like to investigate why.&lt;/p&gt;</comment>
                            <comment id="629697" author="ramon.fernandez" created="Fri, 20 Jun 2014 23:10:38 +0000"  >&lt;p&gt;&lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=khous&quot; class=&quot;user-hover&quot; rel=&quot;khous&quot;&gt;khous&lt;/a&gt;, apologies for the late reply. Have you seen Asya&apos;s comment and try to reproduce in 2.5.5? If you upgrade to a version &amp;gt;= 2.5.5 or anything in the 2.6 series and continue to see the behavior you describe, can you please send us the actual query so we can try to reproduce and investigate on our end?&lt;/p&gt;</comment>
                            <comment id="447160" author="asya" created="Sat, 26 Oct 2013 23:45:36 +0000"  >&lt;p&gt;I didn&apos;t see your exact query, but it&apos;s possible that this is a duplicate of &lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-1205&quot; title=&quot;$or sort does not use index ranges expressed in or clauses&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-1205&quot;&gt;&lt;del&gt;SERVER-1205&lt;/del&gt;&lt;/a&gt; if it&apos;s an $or combined with a sort.&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                            <attachment id="32865" name="mongodb-paged-join-performance.xlsx" size="13392" author="khous" created="Tue, 22 Oct 2013 20:00:06 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>4.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10038"><![CDATA[Fully Compatible]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                            <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Sat, 26 Oct 2013 23:45:36 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        9 years, 31 weeks, 2 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            9 years, 31 weeks, 2 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                        <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Old_Backport</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10000"><![CDATA[No]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>asya.kamsky@mongodb.com</customfieldvalue>
            <customfieldvalue>khous</customfieldvalue>
            <customfieldvalue>ramon.fernandez@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hrmab3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrwlt3:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>104269</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_10053" key="com.atlassian.jira.ext.charting:timeinstatus">
                        <customfieldname>Time In Status</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hsp7y7:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>