小表到大表更新

时间:2022-10-19 21:55:28

Problem Details:-

Table 1:- Product_Country A

表1: - Product_Country A.

Description:- Contains Product ID and other details along with Country Code.

说明: - 包含产品ID和其他详细信息以及国家/地区代码。

Table 2:- Product_Outlet B

表2: - Product_Outlet B.

Description:- Contains Product ID and other details along with Outlet Code

说明: - 包含产品ID和其他详细信息以及插座代码

A country can have many outlets, suppose country Australia has 50 outlets. So suppose if i update any details of a product in table A, i want to update the same detail in table B based on some if else conditions.

一个国家可以有很多网点,假设澳大利亚有50个网点。因此,如果我更新表A中产品的任何细节,我想基于if else条件更新表B中的相同细节。

Points to consider:- 1.) Table B is having 50 times more data than table A.

需要考虑的要点: - 1.)表B的数据量比表A多50倍。

2.) There is a Java application through which we update table A.

2.)有一个Java应用程序,通过它我们更新表A.

3.) There are some rules to update the details in table B, some if else conditions based on which we update and create records in it.

3.)有一些规则来更新表B中的细节,一些if else条件基于我们更新并在其中创建记录。

Current Solution:- There is a trigger which puts entry in a Temp table while updating/inserting A, from where a PL/SQL job scheduled twice a day, picks up the data and update/insert in the table B. This solution was considered, because updating the B table right after A table will consume much time and the application will be unresponsive.

当前解决方案: - 有一个触发器在更新/插入A时将条目放入Temp表中,每天调度两次PL / SQL作业,在表B中获取数据并更新/插入。此解决方案被考虑,因为在A表之后更新B表将消耗很多时间并且应用程序将无响应。

Solutions Considered but rejected:- 1.) Updating table B right after A table, will consume much time.

考虑但拒绝的解决方案: - 1.)在A表之后更新表B将消耗很多时间。

2.) Increasing frequency of scheduled job, would hog the Database.

2.)增加预定作业的频率,会占用数据库。

More Solution Proposals??????

更多解决方案建议??????

1 个解决方案

#1


1  

A solution would be to have a "product" table, with references from table A and table B.

一个解决方案是拥有一个“产品”表,其中包含表A和表B的参考。

So if you update product for country in the A set, it's instantly updated for occurrences in the B set as well.

因此,如果您在A集中更新国家/地区的产品,它也会立即更新B集中的事件。

This means review your data model: a basic rule is you should not have replicated information in your database.

这意味着要检查您的数据模型:基本规则是您不应该在数据库中拥有复制的信息。

#1


1  

A solution would be to have a "product" table, with references from table A and table B.

一个解决方案是拥有一个“产品”表,其中包含表A和表B的参考。

So if you update product for country in the A set, it's instantly updated for occurrences in the B set as well.

因此,如果您在A集中更新国家/地区的产品,它也会立即更新B集中的事件。

This means review your data model: a basic rule is you should not have replicated information in your database.

这意味着要检查您的数据模型:基本规则是您不应该在数据库中拥有复制的信息。