• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Options for a Subquery

 
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 338
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author
Posts: 82
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic