当前位置:网站首页>在kettle中快速更新一个字段中的信息
在kettle中快速更新一个字段中的信息
2022-07-27 06:10:00 【hawanglc】
数据库中有订单表tb_order,其中有order_id和user_id和user_name等字段。
数据库中有用户资料表tb_user,其中有user_id和user_name等字段。
现在需要使用tb_user.user_name来更新tb_order.user_name,两个表的关联条件是tb_order.user_id = tb_user.user_id。
通常,在两个表都静止的时候,可以使用一个update来解决,如下。
update tb_order
set user_name = (select user_name from tb_user u where u.user_id = tb_order.user_id);
但是,如果这两个表的数据量较大,且两个表都在生产频繁使用的时候,一个update语句会锁表,且需要较长的时间,从而可能会导致正常的业务无法快速进行。
此时,就应该单独遍历tb_order表中的每一条记录,然后根据tb_order.user_id去tb_user中查询每一条记录中的user_name,最后根据tb_order.order_id来更新tb_order.user_name;这个单独遍历的方式,虽然不能完全解决锁表引起的问题,但是也可以较大概率避免。但是这个配置模式,效率非常低。
还有一个更好的思路,一个转换就可以完成的配置。思路如下:
1、使用表输入,从tb_order表中获得数据;
2、使用数据库连接控件,直接从表输入的结果中获得参数,然后执行查询,从tb_user表得到需要的信息;
3、使用插入更新空间,直接修改tb_order中指定的字段。
因为这三个步骤在一个转换中,所以,可以在第2步和第三步中设置并发数量来提高kettle的处理效率。
配置如下:

边栏推荐
- C4D动画如何提交云渲染农场快速渲染?
- Leetcode series (I): buying and selling stocks
- Codeforces Round #804 (Div. 2)(5/5)
- Relevant principles of MySQL index optimization
- 软件测试十大必问面试题(附答案和解析)
- docker安装MySQL8.0.28
- Es compares the data difference between the two indexes
- Watermelon book learning notes - Chapter 1 and 2
- Golang encapsulates the packages involved in MySQL and the differences between sqlx and Gorm
- [Vani有约会]雨天的尾巴
猜你喜欢

pytorch笔记:TD3

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

Flutter实战-请求封装(一)

Digital image processing -- Chapter 3 gray scale transformation and spatial filtering

ESP8266(ESP-12F) 第三方库使用 -- SparkFun_APDS9960 (手势识别)

MySQL2

Drools (5): drools basic syntax (3)

Synchronized锁

(posted) comparison of Eureka, consumer and Nacos 1

A Competitive Swarm Optimizer for Large Scale Optimization
随机推荐
Jest single test style problem [identity obj proxy] NPM package
Golang encapsulates the packages involved in MySQL and the differences between sqlx and Gorm
在Perl程序中暴露Prometheus指标
Linear table -- stack and queue
Drools (5): drools basic syntax (3)
【QT】无法在QT创建者中打开包含文件pcap.h(C1083)
12. Integer to Roman整数转罗马数字
Flutter实战-请求封装(一)
Watermelon book learning notes - Chapter 1 and 2
(转帖)eureka、consul、nacos的对比2
泛型 -- 学会它,好处多多
How to learn C language? This article gives you the complete answer
Excuse me, is there a big delay in individual capture when someone uses Oracle xStream? How to solve the delay problem
二叉树--天然的查找语义(1)基础篇
零号培训平台课程-1、SQL注入基础
tableau prep连接maxcompute,只是书写很简单的sql,为啥报这个错误呢?
想sink 到 redis-hash 里面 把 对象的属性和值都写进去 ,大佬们有Demo 吗?
adb指令整理
Golang controls the number of goroutines and obtains processing results
? Experiment 7 implementation of PHP management system based on MySQL