• Post Reply Bookmark Topic Watch Topic
  • New Topic

Comparing Temporary table with a huge database  RSS feed

 
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In my program I create a temp table with few thousand records. I want to find the entries that are only in the temp table and not in the main table ; which is huge containing hald a million records.[id - name]

I did a inner join on the name value and then outer join on the result i.e Temp - (Temp intersection Main Table). The query executes in a fraction of a second but in the program the processing of result set is slow.

Any other solutions that can handle this situation.
 
author & internet detective
Marshal
Posts: 37698
575
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pradeep,
Since the query itself is executing quickly, the query is fine. What are you doing when processing the result set? Try looping through the result set in an empty loop to see if it is the network transfer or the loop body.

If the network tranfser, try returning less fields in the select clause. (This is actually a good idea anyway if there are unused fields.) If not, look into which statements in the loop body are taking the longest.
 
Pradeep Kadambar
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the resultset I just take two field id and name and then create an object from it. If the file path (Which is one of the fields) is new then an insert statement is addd to batch and then executed.

If the resultset is empty the program executes faster.

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!