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.
subject: Comparing Temporary table with a huge database