B tree indices support nested loops within index scans.
postgres=# create table temp_table(id serial primary key, v integer, b integer);
CREATE TABLE
postgres=# insert into temp_table(v) values (1), (2), (3);
INSERT 0 3
postgres=# create index on temp_table(v);
CREATE INDEX
postgres=# set enable_seqscan = off;
SET
postgres=# create table temp_table2(id serial primary key);
CREATE TABLE
postgres=# explain select 1 from temp_table join temp_table2 using (id) order by v;
QUERY PLAN
-----------------------------------------------------------------------------------------------
Nested Loop (cost=0.29..28.70 rows=3 width=8)
-> Index Scan using temp_table_v_idx on temp_table (cost=0.13..12.18 rows=3 width=8)
-> Index Only Scan using temp_table2_pkey on temp_table2 (cost=0.15..5.51 rows=1 width=4)
Index Cond: (id = temp_table.id)
B tree indices support nested loops within index scans.
We should do the same.