当前位置:网站首页>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 :

边栏推荐
猜你喜欢

Instruction set x digital technology accelerates the digital transformation of government and enterprises, and builds Unicorn enterprise alliance in DT field

(posted) comparison of Eureka, consumer and Nacos 1

(2022 Hangdian multi school III) 1009.package delivery (greedy)

VLAN trunk实验

Jmeter:接口自动化测试-BeanShell对数据库数据和返回数据比较

Convert Excel to csv/csv UTF-8

Use reflection to dynamically modify annotation attributes of @excel

零号培训平台课程-2、SSRF基础

Zabbix: 将收集到值映射为易读的语句

C# 常用功能整合-3
随机推荐
MySQL optimization SQL related (continuous supplement)
functools模块
Flutter实战-请求封装(一)
35. Search insert position
Golang controls the number of goroutines and obtains processing results
Drools(5):Drools高级语法
Excuse me, is there a big delay in individual capture when someone uses Oracle xStream? How to solve the delay problem
adb指令整理
js做一个红绿灯
12. Integer to Roman
oracle清理含有引用分区的表的数据库磁盘空间
Use reflection to dynamically modify annotation attributes of @excel
Synchronized锁
MySQL2
Es compares the data difference between the two indexes
tigervnc的使用
Li Mu hands-on learning, in-depth learning, V2 transformer and code implementation
Bash: 创建返回布尔类型值的函数
一款开源 OA 办公自动化系统
用shell来计算文本中的数字之和