• 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

Query-performance question

 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All,
I have a requirement to do a select * from a table to output all records based on one input.
The query will be select *[29 fields] from xtable where xfield like ''.

Now this can return anywhere upto 45000 records.

What can I do to maximize the performace of this ? Is using a preparedstatement good idea ? Any thoughts appreciated.

Thanks
 
Ranch Hand
Posts: 694
Mac OS X Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A prepared statement is useful when you want to send a similiar query to the database engine where the query is the same except that there are different parameters. Here, it sounds like you have one query that is run in which case I don't think that a prepared statement would help.

What do you do with the 45,000 records?

What about a stored procedure which runs on the server-side? This would keep the records from having to come across to the client-side.

If you're viewing the records in a JTable, there's the ResultSetTableModel. I believe that a ResultSetTableModel just brings across the records as necessary to be viewed a screenful at-a-time.

Would it help to use a LIMIT clause and bring the records over, let's say 100 at-a-time? Only as needed.

Kaydell
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why a batch for processing 45,000 records. Write a Stored procedure, invoke it in a Java main method.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic