【发布时间】:2023-03-12 06:01:01
【问题描述】:
[用户在YugabyteDB Community Slack上发布的问题]
我有这个架构,但我没有使用 pg_hint_plan 来强制 HashJoin(a,b):
yugabyte=# create table a(id int);
yugabyte=# create table b(id int);
yugabyte=# create table c(id int);
yugabyte=# explain select * from a natural join b natural join c;
QUERY PLAN
------------------------------------------------------------------------------
Merge Join (cost=449.49..909.49 rows=25000 width=4)
Merge Cond: (c.id = a.id)
-> Sort (cost=149.83..152.33 rows=1000 width=4)
Sort Key: c.id
-> Seq Scan on c (cost=0.00..100.00 rows=1000 width=4)
-> Materialize (cost=299.66..392.16 rows=5000 width=8)
-> Merge Join (cost=299.66..379.66 rows=5000 width=8)
Merge Cond: (a.id = b.id)
-> Sort (cost=149.83..152.33 rows=1000 width=4)
Sort Key: a.id
-> Seq Scan on a (cost=0.00..100.00 rows=1000 width=4)
-> Sort (cost=149.83..152.33 rows=1000 width=4)
Sort Key: b.id
-> Seq Scan on b (cost=0.00..100.00 rows=1000 width=4)
(14 rows)
【问题讨论】:
标签: yugabyte-db