Ough, I believed I had use_remote_estimate = true in my database, but it was false :(
"Nested Loop (cost=100.45..108.97 rows=100000 width=16) (actual time=1.037..1.037 rows=0 loops=1)"
" Output: foreign_table.primary_uuid"
" -> HashAggregate (cost=0.02..0.03 rows=1 width=16) (actual time=0.004..0.004 rows=1 loops=1)"
" Output: ('ef89a151-3eab-42af-8ecc-8850053aa1bb'::uuid)"
" Group Key: 'ef89a151-3eab-42af-8ecc-8850053aa1bb'::uuid"
" -> Result (cost=0.00..0.01 rows=1 width=16) (actual time=0.001..0.001 rows=1 loops=1)"
" Output: 'ef89a151-3eab-42af-8ecc-8850053aa1bb'::uuid"
" -> Append (cost=100.43..108.92 rows=2 width=16) (actual time=1.032..1.032 rows=0 loops=1)"
" -> Foreign Scan on foreign_server.foreign_table (cost=100.43..104.47 rows=1 width=16) (actual time=0.994..0.994 rows=0 loops=1)"
" Output: foreign_table.primary_uuid"
" Remote SQL: SELECT primary_uuid FROM public.foreign_table WHERE (($1::uuid = primary_uuid))"
" -> Index Only Scan using local_table_pkey on public.local_table (cost=0.42..4.44 rows=1 width=16) (actual time=0.035..0.035 rows=0 loops=1)"
" Output: local_table.primary_uuid"
" Index Cond: (local_table.primary_uuid = ('ef89a151-3eab-42af-8ecc-8850053aa1bb'::uuid))"
" Heap Fetches: 0"
"Planning Time: 100.619 ms"
"Execution Time: 1.243 ms"
I tried this with use_remote_estimate = true for different real queries with a lot of joins and everything works well!