February 25, 2014 at 9:04 am
Is there any other way of writing this query ?
SQL Server 2008 R2
LEFT OUTER LOOP JOIN PART_LIST p1 ON e.COLUMN3 = p1.CODE
AND p1.LIST_TYPE = 'PART_TEST_TYPE'
AND p1.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p2 ON e.SOURCE1 = p2.CODE
AND p2.LIST_TYPE = 'SOURCE_TYPE'
AND p2.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p3 ON e.SOURCE2 = p3.CODE
AND p3.LIST_TYPE = 'SOURCE_TYPE'
AND p3.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p4 ON e.STATUS = p4.CODE
AND p4.LIST_TYPE = 'PART_STATUS'
AND p4.LANGUAGE = 'en-US'
February 25, 2014 at 9:08 am
Why do you have LOOP hints in your JOINS?
A better option is to normalize the data 🙂
I'm not sure what can you do better. An EAV design won't be great for performance.
February 25, 2014 at 4:17 pm
How long does it takes to execute the query?
Post Execution plan.
How many records each table has?
February 25, 2014 at 5:30 pm
DKG2014S (2/25/2014)
Is there any other way of writing this query ?SQL Server 2008 R2
LEFT OUTER LOOP JOIN PART_LIST p1 ON e.COLUMN3 = p1.CODE
AND p1.LIST_TYPE = 'PART_TEST_TYPE'
AND p1.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p2 ON e.SOURCE1 = p2.CODE
AND p2.LIST_TYPE = 'SOURCE_TYPE'
AND p2.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p3 ON e.SOURCE2 = p3.CODE
AND p3.LIST_TYPE = 'SOURCE_TYPE'
AND p3.LANGUAGE = 'en-US'
LEFT OUTER LOOP JOIN PART_LIST p4 ON e.STATUS = p4.CODE
AND p4.LIST_TYPE = 'PART_STATUS'
AND p4.LANGUAGE = 'en-US'
Yes. And EAV's aren't necessarily the "horrible problem" that many make them out to be. I just can't advise you because I don't know what the rest of the query does because you've left it out.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply