CREATE TABLE a(x int, t int);
CREATE TABLE b(x int, t int);
INSERT INTO a
SELECT x, random(1,100) FROM generate_series(1,10000) g(x);
INSERT INTO b
SELECT x, random(1,100) FROM generate_series(1,10000) g(x);
CREATE INDEX ON a(x);
CREATE INDEX ON b(x);
SET enable_hashjoin = off;
SET enable_mergejoin = off;
SET enable_seqscan = off;
ANALYZE;
EXPLAIN ANALYZE
SELECT
a.t at,
(SELECT t FROM b WHERE b.x = a.x) bt
FROM a;
EXPLAIN ANALYZE
SELECT
a.t at,
b.t bt
FROM a
JOIN b ON b.x = a.x;