Hi, I reviewed and tested the latest v22 patch series for Asynchronous MergeAppend. I was able to reproduce the reported behavior using two postgres_fdw servers with async_capable = on. Before applying the patch, I ran the following query
EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM players_remote1 UNION ALL SELECT * FROM players_remote2 ORDER BY score, id; The plan showed Merge Append -> Foreign Scan on public.players_remote1 -> Foreign Scan on public.players_remote2 So even though both foreign servers were configured with async_capable = on, the MergeAppend plan was still using regular Foreign Scan nodes. I then applied the v22 patch series, rebuilt PostgreSQL and ran the same test again. After applying the patch, the plan changed to Merge Append -> Async Foreign Scan on public.players_remote1 -> Async Foreign Scan on public.players_remote2 This looks correct to me and shows that MergeAppend is now able to make use of the asynchronous foreign scan capability. I also checked the query result after the patch. The two remote tables contained 5,000 rows each and the query returned all 10,000 rows as expected. I did not run a performance comparison, so I have not evaluated the actual performance improvement. Overall, the patch worked as expected in my testing. Regards, solai
