• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Options for a Subquery

 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have read that subqueries perform much slower. I would like to know what are the other options available we can consider instead of using subqueries. I have seen 80% subqueries in the Stored procedures which I am accessing in Java.
I remember once we had used Temp table approach to reduce this usage. I am not an expert in Database but occasionally need to write some queries and Stored procedures.

Thanks,
Amit
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before diving off into alternatives, perhaps it would be best to ascertain that sub-queries are actually a problem? Just reading it somewhere doesn't mean it's a real issue, and even if they are in certain circumstances, it's best to verify that something is an actual problem in your environment before flying off the handle.
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
Thanks for your reply. I agree with whatever you have said. I just wanted to know whether this kind of topic is available in the HF SQL.
Thanks once again,
Amit
 
Paul Campbell
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Poorly written queries always perform poorly.

Sub-queries are a necessary part of set processing. Learning to write quality queries entails you learn how to write effective sub-queries.
 
Lynn Beighley
author
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In HF SQL, we deal with presenting some subqueries as joins, and vice versa, but do not offer an opinion on the difference in performance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic