<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Fri May 24 13:15:43 UTC 2013

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 add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DDC-1526/DDC-1526.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DDC-1526] Unecessary queries with LEFT JOIN</title>
                <link>http://www.doctrine-project.org/jira/browse/DDC-1526</link>
                <project id="10032" key="DDC">Doctrine 2 - ORM</project>
                        <description>&lt;p&gt;After upgrading to 2.1.4 (from 2.1.2), the following dql started creating way more queries than necessary :&lt;br/&gt;
SELECT m, p, s, c, o&lt;br/&gt;
FROM FERMainBundle:Menu m&lt;br/&gt;
LEFT JOIN m.page p&lt;br/&gt;
LEFT JOIN m.section s&lt;br/&gt;
LEFT JOIN m.children c&lt;br/&gt;
LEFT JOIN s.position o&lt;br/&gt;
ORDER BY m.lft&lt;/p&gt;

&lt;p&gt;Details to the code here:&lt;br/&gt;
&lt;a href=&quot;http://pastie.textmate.org/private/z9gtgqe1odwenxcmudywqa&quot; class=&quot;external-link&quot;&gt;http://pastie.textmate.org/private/z9gtgqe1odwenxcmudywqa&lt;/a&gt;&lt;br/&gt;
The model looks like that:&lt;br/&gt;
&lt;a href=&quot;http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a&quot; class=&quot;external-link&quot;&gt;http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a&lt;/a&gt;&lt;/p&gt;


&lt;p&gt;&lt;a href=&quot;http://pastie.textmate.org/private/ob1jqiekv89e4xj9bq06q&quot; class=&quot;external-link&quot;&gt;http://pastie.textmate.org/private/ob1jqiekv89e4xj9bq06q&lt;/a&gt;&lt;br/&gt;
First query is executed, it should in fact retrieve everything there is about the menu, but then it runs the second query for every menu element I have, generating a lot of queries that didn&apos;t occur before.&lt;/p&gt;</description>
                <environment>PHP 5.3.6</environment>
            <key id="13250">DDC-1526</key>
            <summary>Unecessary queries with LEFT JOIN</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="1">Fixed</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="nenuial">Pascal Burkhard</reporter>
                        <labels>
                    </labels>
                <created>Fri, 9 Dec 2011 19:22:23 +0000</created>
                <updated>Tue, 23 Oct 2012 11:41:45 +0000</updated>
                    <resolved>Sat, 28 Jan 2012 11:28:38 +0000</resolved>
                            <version>2.1.4</version>
                                <fixVersion>2.1.6</fixVersion>
                <fixVersion>2.2</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="16997" author="beberlei" created="Thu, 15 Dec 2011 20:04:07 +0000"  >&lt;p&gt;Can you profile where exactly the extra queries are executed using xdebug_start_trace? Directly during hydration or later in your code?&lt;/p&gt;</comment>
                    <comment id="17053" author="nenuial" created="Mon, 19 Dec 2011 18:22:40 +0000"  >&lt;p&gt;xdebug trace start just before I query the database&lt;/p&gt;</comment>
                    <comment id="17062" author="beberlei" created="Tue, 20 Dec 2011 07:54:28 +0000"  >&lt;p&gt;Hi Pascal, sorry but this is not enough. I need this query until all the other entities (or at least one) are n+1 joined.&lt;/p&gt;</comment>
                    <comment id="17063" author="nenuial" created="Tue, 20 Dec 2011 11:30:21 +0000"  >&lt;p&gt;Here the complete trace, started just before the first query. I&apos;m sorry but I can&apos;t make heads or tails with that... I hope it can help you pinpoint the problem.&lt;/p&gt;

&lt;p&gt;Please also note that I have update Doctrine ORM to 2.1.5 and there was a change in the number of &quot;superfluous&quot; queries done. I am now only left with additional queries to get the relations to &quot;parent&quot;, cf the model ( &lt;a href=&quot;http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a&quot; class=&quot;external-link&quot;&gt;http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a&lt;/a&gt; ).&lt;/p&gt;</comment>
                    <comment id="17132" author="beberlei" created="Wed, 28 Dec 2011 19:41:49 +0000"  >&lt;p&gt;Is the trace from before upgrade to 2.1.5 or after?&lt;/p&gt;</comment>
                    <comment id="17133" author="nenuial" created="Wed, 28 Dec 2011 19:44:45 +0000"  >&lt;p&gt;The &quot;complete&quot; trace, i.e. the one that is 5.94 mb big is from after the upgrade to 2.1.5.&lt;/p&gt;</comment>
                    <comment id="17143" author="beberlei" created="Thu, 29 Dec 2011 15:32:02 +0000"  >&lt;p&gt;Can you disable the nested set extension? the other ticket uses it too and i want to rule out that its the extensions fault. &lt;/p&gt;</comment>
                    <comment id="17149" author="nenuial" created="Thu, 29 Dec 2011 22:14:24 +0000"  >&lt;p&gt;Alright. I deactivated the Tree extension, but there are no changes in the number of queries.&lt;/p&gt;</comment>
                    <comment id="17348" author="beberlei" created="Sat, 28 Jan 2012 11:19:12 +0000"  >&lt;p&gt;I found the issue.&lt;/p&gt;</comment>
                    <comment id="17349" author="beberlei" created="Sat, 28 Jan 2012 11:28:38 +0000"  >&lt;p&gt;Fixed&lt;/p&gt;</comment>
                </comments>
                <issuelinks>
                        <issuelinktype id="10000">
                <name>Duplicate</name>
                                                <inwardlinks description="is duplicated by">
                            <issuelink>
            <issuekey id="13320">DDC-1573</issuekey>
        </issuelink>
                    </inwardlinks>
                            </issuelinktype>
                    </issuelinks>
                <attachments>
                    <attachment id="11134" name="trace.txt" size="6229522" author="nenuial" created="Tue, 20 Dec 2011 11:30:21 +0000" />
                    <attachment id="11133" name="trace.txt" size="40737" author="nenuial" created="Mon, 19 Dec 2011 18:22:40 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>