Home › Forums › kdb+ › help understanding a function › Reply To: help understanding a function
-
Yes with right to left evaluation it is being saved then sorted.
The reason this may have been done is that sorting in memory will temporarily use extra memory to perform the operation.
https://code.kx.com/q/ref/asc/#sorting-data-on-disk
Sorting on disk is very memory efficient as it does not bring the full table in to memory.
The trade off is it is slower as each column gets written twice.
q)tab:flip (`$/:.Q.an)!{1000000?10000.0}each .Q.an q)\ts `a xasc `:tab/ set tab q) 1824 25168800 q)\ts `:tab/ set `a xasc tab 1165 536874192 q)536874192%25168800 21.33094 //Sorting in memory uses 21x memory than sorting on disk