DDC-1526: Unecessary queries with LEFT JOIN #1915

Open
opened 2026-01-22 13:30:51 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Dec 9, 2011).

Originally assigned to: @beberlei on GitHub.

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:
http://pastie.textmate.org/private/z9gtgqe1odwenxcmudywqa
The model looks like that:
http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a

http://pastie.textmate.org/private/ob1jqiekv89e4xj9bq06q
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.

Originally created by @doctrinebot on GitHub (Dec 9, 2011). Originally assigned to: @beberlei on GitHub. 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: http://pastie.textmate.org/private/z9gtgqe1odwenxcmudywqa The model looks like that: http://pastie.textmate.org/private/przxzfimsfyua02cxqcv9a http://pastie.textmate.org/private/ob1jqiekv89e4xj9bq06q 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.
admin added the Bug label 2026-01-22 13:30:51 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1915