Jira issue originally created by user nenuial:
After upgrading to 2.1.4 (from 2.1.2), the following dql started creating way more queries than necessary :
SELECT m, p, s, c, o
FROM FERMainBundle:Menu m
LEFT JOIN m.page p
LEFT JOIN m.section s
LEFT JOIN m.children c
LEFT JOIN s.position o
ORDER BY m.lft
Details to the code here:
The model looks like that:
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't occur before.
Comment created by @beberlei:
Can you profile where exactly the extra queries are executed using xdebugstarttrace? Directly during hydration or later in your code?
Comment created by nenuial:
xdebug trace start just before I query the database
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.
Here the complete trace, started just before the first query. I'm sorry but I can't make heads or tails with that... I hope it can help you pinpoint the problem.
Please also note that I have update Doctrine ORM to 2.1.5 and there was a change in the number of "superfluous" queries done. I am now only left with additional queries to get the relations to "parent", cf the model ( http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a ).
Is the trace from before upgrade to 2.1.5 or after?
The "complete" trace, i.e. the one that is 5.94 mb big is from after the upgrade to 2.1.5.
Can you disable the nested set extension? the other ticket uses it too and i want to rule out that its the extensions fault.
Alright. I deactivated the Tree extension, but there are no changes in the number of queries.
I found the issue.
Issue was closed with resolution "Fixed"
Imported 2 attachments from Jira into https://gist.github.com/720f2ac3449108cafcaa