当前位置:网站首页>Quickly update the information in a field in kettle
Quickly update the information in a field in kettle
2022-07-27 07:25:00 【hawanglc】
There is an order table in the database tb_order, Among them is order_id and user_id and user_name Etc .
There are user data tables in the database tb_user, Among them is user_id and user_name Etc .
Now you need to use tb_user.user_name To update tb_order.user_name, The association condition of the two tables is tb_order.user_id = tb_user.user_id.
Usually , When both watches are stationary , You can use one update To solve , as follows .
update tb_order
set user_name = (select user_name from tb_user u where u.user_id = tb_order.user_id);
however , If the data volume of these two tables is large , And both tables are frequently used in production , One update Statement will lock the table , And it takes a long time , Thus, normal business may not be carried out quickly .
here , It should be traversed separately tb_order Every record in the table , And then according to tb_order.user_id Go to tb_user Query the user_name, According to the tb_order.order_id To update tb_order.user_name; This way of traversal alone , Although it can't completely solve the problem caused by locking the table , But it can also be avoided with a high probability . But this configuration mode , Very inefficient .
There is a better idea , Configuration that can be completed by a transformation . Ideas as follows :
1、 Use table input , from tb_order Data from the table ;
2、 Use the database connection control , Get parameters directly from the results entered in the table , Then execute the query , from tb_user Table get the information you need ;
3、 Use insert to update space , Directly modifying tb_order The fields specified in .
Because these three steps are in a transformation , therefore , In the first 2 Set the number of concurrency in step and step to improve kettle The processing efficiency of .
The configuration is as follows :

边栏推荐
猜你喜欢
随机推荐
VLAN trunk experiment
MySQL limit paging query optimization practice
使用反射实现动态修改@Excel的注解属性
在Perl程序中暴露Prometheus指标
flink cdc 抽取oracle的数据,会不断的占用oracle的内存吗,最后引发ora-040
查看服务器重启前的 dmesg 日志
C4D云渲染平台选哪家合作?
(2022 Hangdian multi school III) 1011.taxi (Manhattan maximum + 2 points)
Es compares the data difference between the two indexes
使用popen来执行一个命令并获得返回结果
【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
MySQL index failure and solution practice
Single arm routing (explanation + experiment)
Routing between VLANs (explanation + verification)
UUID与secrets模块
如何取得对象的DDL信息
Want to sink into redis hash and write in the attributes and values of the object. Do the bosses have a demo?
简单的轮播图
Codeforces Round #787 (Div. 3)(7/7)
Functools module









