Re: [planner] Ignore "order by" in subselect if parrent do count(*)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcin Miros*aw<marcin@xxxxxxxx> wrote:
 
> SELECT count(*)
>   from (select * from users_profile order by id) u_p;
 
> "order by id" can be ignored by planner.
 
This has been discussed before.  Certainly not all ORDER BY clauses
within query steps can be ignored, so there would need to be code to
determine whether it was actually useful, which wouldn't be free,
either in terms of planning time or code maintenance.  It wasn't
judged to be worth the cost.  If you want to avoid the cost of the
sort, don't specify ORDER BY where it doesn't matter.
 
-Kevin

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



[Postgresql General]     [Postgresql PHP]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Yosemite]

  Powered by Linux