[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Re: [HACKERS] Optimizer sorting an already sorted result
From:       Tom Lane <tgl () sss ! pgh ! pa ! us>
Date:       2008-04-30 2:02:04
Message-ID: 12174.1209520924 () sss ! pgh ! pa ! us
[Download RAW message or body]

"Gurjeet Singh" <singh.gurjeet@gmail.com> 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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic