Re: Limit and inherited tables - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Limit and inherited tables
Date
Msg-id 21490.1452875432@sss.pgh.pa.us
Whole thread Raw
In response to Re: Limit and inherited tables  (Konstantin Knizhnik <k.knizhnik@postgrespro.ru>)
List pgsql-hackers
Konstantin Knizhnik <k.knizhnik@postgrespro.ru> writes:
>> This example is lacking indexes on the child tables, which is
>> why the plan shown is about as good as you're going to get.
>> The contents of foo1 and foo2 have to be read in entirety in any
>> case, and sorting them separately is not a win compared to doing
>> a single sort.

> It is true, but not in case of FDW connected to remote host.
> In this case sending large volumes of data through network will be very 
> inefficient.

If the FDW isn't providing a sorted path, there is no way to improve the
situation much.  You can't just "push the LIMIT", you'd have to push
"ORDER BY ... LIMIT", which will mean that a sort has to happen anyway.
If the remote end can do a fast-start sort efficiently, it should report
that, and then a merge-append plan is just fine.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Death by regexp_replace
Next
From: "Shulgin, Oleksandr"
Date:
Subject: Re: Stream consistent snapshot via a logical decoding plugin as a series of INSERTs