On Fri, Mar 8, 2019 at 9:15 PM Tom Lane <t...@sss.pgh.pa.us> wrote: > > David Rowley <david.row...@2ndquadrant.com> writes: > > [ v9-0001-Allow-Append-to-be-used-in-place-of-MergeAppend-f.patch ] > > I think you should remove all that > and restrict this optimization to the case where all the subpaths are > natively ordered --- if we have to insert Sorts, it's hardly going to move > the needle to worry about simplifying the parent MergeAppend to Append.
This can be a huge win for queries of the form "ORDER BY partkey LIMIT x". Even if the first subpath(s) aren't natively ordered, not all of the sorts should actually be performed.