Win a copy of Spark in Action this week in the Open Source Projects forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Is length of SQL query important?

 
Ranch Hand
Posts: 49
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I write code in java , i can write sql query in 2 conditions , but short sql query is very diffucult for java . what is the difference between short sql query and long sql query ? they print same results. Which code Should i use ?
 
Bartender
Posts: 1268
39
IBM DB2 Netbeans IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the ranch! As far as I know, length of a sql statement doesn't affect query performance by itself. Performance depends upon factors like proper indexing of tables, quality of this query optimizer and so on.
 
Rancher
Posts: 4603
47
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not too sure what you mean by "short sql query is very difficult for java".

The way to compare the efficiency of two queries is to use the database tools (eg EXPLAIN PLAN in Oracle) which allow you to see the plan that has been generated for the query.
This takes some experience, though.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic