Subject 'Order By' Issue
Author Dmitry Yemanov

I think my question is not a support one, but please don't shoot me, Helen,
if you have different opinion ;-)

Who could explain in details, how the engine performs queries with ORDER BY

I have one relatively big table (~20000 records) and a few small ones (0 to
1000 records) in my database (6MB). When I'm trying to select all fields
from the big table left joined with all others without sorting, it works
fine. When I'm trying to perform the same statement with ORDER BY, a
temporary sorting file is being created by the engine, but this file is
finally ~600MB in size. Simple calculation shows that the complete result
set for my query should have the similar size, but only in the case when
all fields are stored with their maximum possible size, for example ~255
bytes for VARCHAR(255) and so on. Is it true or it's just coincidence?

Any comments appreciated.

Best regards,