• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Query-performance question

 
Atul Mishra
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • 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
 
Kaydell Leavitt
Ranch Hand
Posts: 689
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • 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
 
sathish kumar
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why a batch for processing 45,000 records. Write a Stored procedure, invoke it in a Java main method.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic