Performing "Optimized" set Operations on java.util.ArrayList or in SQL -



Performing "Optimized" set Operations on java.util.ArrayList or in SQL -

this first time need inquire question query solved before today previous threads able solve queries.

scenario: have 2 tables(lets & b) in database same rows , different rows. point note both tables have millions of rows or @ to the lowest degree more million.

now have perform set operations on them no. of same rows (intersection) , no. of new rows(a-b) , no. of old rows (b-a).

i have 2 choices: 1) can perform set operations query it-self on database.

2) or can fetch records , perform operations on java.util.arraylist in memory.

but in both cases taking long around 5 10 mins best(optimized) approach this.

please help.

first of all, union, minus, etc. not operations on tables, on select statement results. in case scanning huge tables, create huge result sets , compare each of results. slow. have optimize in way indices can used.

second, loading results db java, , processing them inherently slower process in db, , ready result in java.

java sql query-optimization set set-operations

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -