On Mon, Jan 15, 2018 at 12:31 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> After some thought, it seems that there's a much simpler way that we
>> could fix the problem you identified in that original email: if the
>> EPQ path isn't properly sorted, have postgres_fdw's
>> add_paths_with_pathkeys_for_rel stick a Sort node on top of it. I
>> tried this and it does indeed fix Jeff Janes' initial test case.
>
> Hm. Simple is certainly good, but if there's multiple rows coming
> back during an EPQ recheck then I think we have a performance problem.
You are correct ... I was wrong about that part, and said so in an
email on this thread sent about 45 minutes before yours. However, I
still think the patch is a good fix for the immediate issue, unless
you see some problem with it. It's simple and back-patchable and does
not preclude further work anybody, including you, might want to do in
the future.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company