简体   繁体   中英

Data Update using Java vs Database

I want to find out the best approach to Data Updates between Java and MonogoDB.

Lets say, I have two database tables Table_A(have more than 100K Rows) and Table_B and I want to copy data of Table_A into Table_B. But the catch is that I want to copy only few Columns of Table_A into Table_B. I have two solutions to do this 1) One is java take data from Table_A iterate all the rows and copy into Table_B. 2) A simple Query of Database, which will copy data from Table_A to Table_B as per the chosen column.

I want to know which one will be an efficient approach in term time consumption and Memory Consumption.

Obviously from performance point of view do it directly on using SQL query, On SQL we have so many inbuilt function to manipulate any column value; As well as you can choose few column from TABLE_2 to TABLE_1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM