简体   繁体   English

使用Java与数据库进行数据更新

[英]Data Update using Java vs Database

I want to find out the best approach to Data Updates between Java and MonogoDB. 我想找出在Java和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. 可以说,我有两个数据库表Table_A(行数超过100K)和Table_B,我想将Table_A的数据复制到Table_B中。 But the catch is that I want to copy only few Columns of Table_A into Table_B. 但是要注意的是,我只想将Table_A的几列复制到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. 我有两种解决方案可以做到这一点:1)一种是Java从Table_A中获取数据,对所有行进行迭代并复制到Table_B中。 2) A simple Query of Database, which will copy data from Table_A to Table_B as per the chosen column. 2)一个简单的数据库查询,它将根据所选列将数据从Table_A复制到Table_B。

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; 显然,从性能的角度来看,可以直接使用SQL查询来完成。在SQL上,我们有很多内置函数可以处理任何列值。 As well as you can choose few column from TABLE_2 to TABLE_1. 您还可以从TABLE_2到TABLE_1中选择几列。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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