-
Type: Bug Report
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 5.1.2-B1
-
Fix Version/s: 5.2.0-B1
-
Component/s: Optimization
-
Labels:None
-
External issue URL:
-
Change Log Message:Automatically remove used LEFT JOIN clauses from COUNT database queries
-
Story Points:2
-
External issue ID:975
-
Copy Issue Key:
-
Patch Instructions:
That's not a rare case, when data from referenced table should be displayed along with data from table being viewed.
To do that "LEFT JOIN" clause is added a SELECT query being used for data retrieval from database.
That's not a bad habit actually. But, when table contains 1 million records and has 5 LEFT JOINs on it, then it really slows COUNT database query, used to calculate pagination for that grid.
I propose that we dynamically remove "LEFT JOIN" parts of database query if JOINed table isn't used anywhere in that database query.
For example this query doesn't use JOINed table at all, so we can remove it automatically:
SELECT table1.*
FROM table1
LEFT JOIN on table2 ON table1.field = table2.field
WHERE table1.field = 'test';
- blocks
-
INP-1765 Use table alias, when creating calculated fields for catalog items
- Resolved
- parent of
-
INP-1761 Account for LeftJoinOptimizer during grid total calculation
- Resolved
-
INP-1355 Make "LeftJoinOptimizer" understand multi-line SQLs with JOINs
- Closed
-
INP-1573 Replace self-table reference in SQL, used by "LeftJoinOptimizer" class
- Closed