Hey Abhishek,
Compared to all GUID at one go looping will surely have a performance issue. But if you compare looping with select statements, latter will be better.
As far as dump is concerned, cannot say much as I don't have your system. The 'Sort' statement in my system is a little different than what you'v mentioned, perhaps as I'm on EHP3. Do an F1 on sort statement to see what is the exception coming in your system.
Cheers
Niraj