Hi, I have reviewed this patch further and here are my comments:
1. Will it be better to use compare_pathkeys() instead of equal(root->query_pathkeys, pathkeys)? 2. I think it will be good if we add a simple test-case in postgres_fdw.sql which shows that LIMIT is passed to remote server. We might convert one of the affected EXPLAIN to EXPLAIN ANALYZE. With this patch, we do push LIMIT on foreign server but not at planning time. Thus we still show remote query in EXPLAIN output without LIMIT clause but we actually push that at execution time. Such explain plan confuses the reader. So I think we better convert them to EXPLAIN ANALYZE or put some comments before the query explaining this. I prefer to put comments as EXPLAIN ANALYZE is costly. 3. "-- CROSS JOIN, not pushed down" Above comment need to be changed now. As you explained already, due to limit clause, CROSS-JOIN is pushed down to remote server, thus need to update this comment. Rest of the changes look good to me. Thanks -- Jeevan Chalke Principal Software Engineer, Product Development EnterpriseDB Corporation The Enterprise PostgreSQL Company