Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SQL Tuning - Enhancement ???


SQL Tuning - Enhancement ???

Author
Message
DKG2014S
DKG2014S
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 69
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'
Luis Cazares
Luis Cazares
SSCrazy Eights
SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)SSCrazy Eights (8.6K reputation)

Group: General Forum Members
Points: 8582 Visits: 18157
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.


Luis C.
General Disclaimer:
Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?


How to post data/code on a forum to get the best help: Option 1 / Option 2
saber_talas
saber_talas
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 110
How long does it takes to execute the query?
Post Execution plan.
How many records each table has?
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45390 Visits: 39942
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

RBAR is pronounced ree-bar and is a Modenism for Row-By-Agonizing-Row.
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search