• Post Reply Bookmark Topic Watch Topic
  • New Topic

Fast db access

 
Marco Bertotti
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i need to access DB as fast as possible (complete query in 3 seconds or less) what's the best approach to use?

JDBC with embedded sql ? yes, lowest level, fastest way ?
JPA lazy ? yes ? it can access as fast as jdbc to primary entities (tables) but then it slows in accessing all related enties
JPA eager? no, this can literally fetch the enteir database if bad configure
Optimized stored procedure ? no, this should be related to a process not to single queries

So, my idea is that JDBC is the fastest.

Any suggestion ?
 
Paul Clapham
Sheriff
Posts: 21867
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll want to make sure that the database can execute the query in a time which meets this requirement. To do that, mostly you have to work on the database's environment. Make sure the database has enough memory, and that suitable indexes are present. Also make sure that the network path between the database and your application is fast enough and is not going to be encumbered by high traffic loads from other applications. How you access the database from your application is relatively unimportant as long as you don't do anything really wrong.
 
Marco Bertotti
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it's not about the DB, it's only about the connection type. So what to choose between the possibilities ?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!