aspose file tools*
The moose likes JDBC and the fly likes Query-performance question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Query-performance question" Watch "Query-performance question" New topic
Author

Query-performance question

Atul Mishra
Ranch Hand

Joined: Jun 08, 2006
Posts: 140
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

Joined: Nov 18, 2006
Posts: 689

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

Joined: Feb 14, 2007
Posts: 47
Why a batch for processing 45,000 records. Write a Stored procedure, invoke it in a Java main method.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Query-performance question