【发布时间】:2021-10-27 15:06:31
【问题描述】:
我有两张桌子
showroom
============================================
model_id car_name is_available
--------------------------------------------
0 rav4 false
1 tacoma false
2 corolla false
3 tundra false
和
warehouse
========================
model_id car_name
------------------------
0 rav4
1 tacoma
主键是model_id。如果model_id 存在于warehouse 中,我想将showroom.is_available 列更新为true。因此,根据上述示例的输出将是
showroom
============================================
model_id car_name is_available
--------------------------------------------
0 rav4 true
1 tacoma true
2 corolla false
3 tundra false
我知道我能做到
UPDATE showroom
SET is_available = true
WHERE model_id IN (
SELECT model_id
FROM warehouse
);
但两个表都有超过十亿行,即使我使用的是 Spark SQL,查询也很慢
【问题讨论】:
-
你的 rdbms 是什么?
-
@BryanDellinger 这些是数据块上的增量表。我正在使用火花 sql
标签: mysql sql apache-spark-sql