"Gurjeet Singh" <[EMAIL PROTECTED]> writes:
> In the plan below, we can see that the optimizer is sorting an already
> sorted result. It seems to forget the sort order across the UNIQUE node. My
> question is, do we make any attempts in the optimizer to remember the sort
> order of a result, to avoid any further sorting on same sort-key? If not,
> can we do something about it?

Per the comment in create_unique_path:

    /*
     * Treat the output as always unsorted, since we don't necessarily have
     * pathkeys to represent it.
     */
    pathnode->path.pathkeys = NIL;

No doubt this could be improved, but I'm unsure about the effort/reward
ratio.

                        regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to