Sort 5 columns with 300 million rows

Hi,
I searched the forum, but doesn’t seem easy task and also tried some solutions already. Did anyone find an easy way to sort ROWS? I would use pivot/unpivot, but I have 5 columns and 300 Million rows, so not sustainable.

Thank you very much in advance.

You can partition the main table and process it partition by partition. In each iteration, unpivot, sort, and repivot one partition at once.

You can make partitions rather big - up to 3-5 million rows each.

1 Like

Ahh dang, I forgot about the iterations :slight_smile: , you’re the Master :slight_smile: . Thanks, will give it a go.