Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Please check the SQL

Posted on 2007-11-20
4
Medium Priority
?
223 Views
Last Modified: 2010-03-20
Can I simplify the query(faster)?

SELECT   Distinct CATGRPDESC.CATGROUP_ID,
         CATGRPDESC.NAME
FROM     CATGRPATTR,
         CATGRPREL,
         CATGRPDESC,
         CATGRPREL CATGRPREL2,
         IMCAPPLICATIONS,
         IMCCATLNREL rel
WHERE    CATGRPATTR.CATGROUP_ID=CATGRPREL.CATGROUP_ID_PARENT
AND      CATGRPDESC.CATGROUP_ID=CATGRPREL.CATGROUP_ID_PARENT
AND      CATGRPREL.CATGROUP_ID_CHILD IN ()
AND      CATGRPATTR.DESCRIPTION IN ()
AND      CATGRPREL2.CATGROUP_ID_PARENT = CATGRPREL.CATGROUP_ID_CHILD
AND      CATGRPREL2.CATGROUP_ID_CHILD = IMCAPPLICATIONS.LINE_ID
AND      IMCAPPLICATIONS.VID IN ()
AND      rel.Line_ID = IMCAPPLICATIONS.LINE_ID
AND      rel.LINE_ID IN ()
AND      rel.Catalog_ID = CATGRPDESC.CATGROUP_ID
ORDER BY IMCCRP.CATGRPDESC.NAME FOR FETCH ONLY

Thanks
Krishna
0
Comment
Question by:vvsrk76
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 19

Accepted Solution

by:
NickUpson earned 500 total points
ID: 20321195
mostly likely you need to add one or more indexes onto the tables, start with the fields used to join between tables
0
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 500 total points
ID: 20322517
that is as simplified as the query gets. you can't achieve performance gains by modifying the select further. as Nick has said, the key is to have an index for all the join conditions

i.e.
CATGRPATTR.CATGROUP_ID,
CATGRPREL.CATGROUP_ID_PARENT,
CATGRPDESC.CATGROUP_ID,
CATGRPREL.CATGROUP_ID_PARENT,
CATGRPREL.CATGROUP_ID_CHILD
etc
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20953234
Forced accept.

Computer101
Community Support Moderator
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

609 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question