This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
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.