-
Notifications
You must be signed in to change notification settings - Fork 302
JOIN实现类型
yuyang edited this page Nov 2, 2022
·
3 revisions
- 嵌套循环join,对两表进行笛卡尔积展开再过滤,主要用于非等值join。
SELECT
t1.id, t2.id
FROM
tj_shop AS t1
JOIN
tj_item AS t2
ON
t1.id > t2.id
- 说明 数据会膨胀,性能比较差
- 说明 链接的表类型为KV/KKV/Summary时,该表的查询条件中必须包含PK等值条件,参考“使用限制”。
- 用于包含等值条件的join
- 将小表按连接键计算出一个hash表,然后从大表一条条抽取记录,计算hash值,根据hash到A表的hash来匹配符合条件的记录。
SELECT
t1.id, t2.id
FROM
tj_shop AS t1
JOIN
tj_item AS t2
ON
t1.id = t2.id
- 用于包含等值条件的join
- 将小表按连接键作为大表的查询条件,去召回大表纪录。
SELECT
t1.id, t2.id
FROM
tj_shop AS t1
JOIN
tj_item AS t2
ON
t1.id = t2.id