Comments - Why is ORDER BY in a FROM Subquery Ignored?

5 years, 4 months ago Darren Lines

Personally, I do see this as a bug, as the subquery is creating a result set, not a table, to a set of specified requirements; one requirement being an order, therefore it should be treated as ordered. This totally screws up previously working code that attempts to group based on the results of the ordered subquery. You cannot sort before grouping on the top level SELECT!

The limit hack seems to work, but must have a performance hit, so thanks @rspadim

 
3 years, 8 months ago Michael Widenius

The LIMIT clause will not have any performance hit as the extra 'limit' row counting is neglectable compared to doing the full ORDER BY.

 
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.