I defined the join order with Leading(b a)
but PostgreSQL, or compatible database like YugabyteDB, still join from a
to b
:
yugabyte=# explain (costs off, timing off)
/*+ Leading( b a ) */
select * from table_a a join table_b b using(id);
QUERY PLAN
--------------------------------------------------
Nested Loop
-> Seq Scan on table_a a
-> Index Scan using table_b_pkey on table_b b
Index Cond: (id = a.id)