?
Solved

Please check the SQL

Posted on 2007-11-20
4
Medium Priority
?
222 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

777 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