MySQL sorting: NULL to the end & use index? Not possible?

Posted by Vojto on Stack Overflow See other posts from Stack Overflow or by Vojto
Published on 2010-04-08T13:30:32Z Indexed on 2010/04/08 13:33 UTC
Read the original article Hit count: 174

Filed under:

Hello fellow experts,

I have a huge table and I want simple sorting.

It could be so easy. I could just create an index and do some really fast sorting thanks to that index.

But my client wants to put NULLs to the end, which is complicates the whole situation.

Instead of simple: SORT BY name ASC I have to do SORT BY name IS NULL ASC, name ASC. That would be ok, but it because of that my index is useless, and the sorting is very slow.

I don't know if there's a way to solve this problem, but if there is one, I desperately ask for help. :'(

© Stack Overflow or respective owner

Related posts about mysql