Home › Forums › KX Academy › Issue with Order in the by statement › Re: Issue with Order in the by statement
-
Link to your original post for reference:
You can test yourself and compare time and memory usage:
- https://code.kx.com/q/basics/syscmds/#ts-time-and-space
- https://code.kx.com/q/wp/columnar-database/
- https://code.kx.com/q/ref/set-attribute/
//Try and time the queries to compare \ts select last price by hour:60 xbar time.minute, sym from trade \ts select last price by sym,hour:60 xbar time.minute from trade //If they run very fast you can run them N number of times to get more accurate result //Running 100 times here \ts:100 select last price by hour:60 xbar time.minute, sym from trade \ts:100 select last price by sym,hour:60 xbar time.minute from trade //Attributes are useful in kdb+ //Apply grouped on sym and test update `g#sym from `trade \ts:100 select last price by hour:60 xbar time.minute, sym from trade \ts:100 select last price by sym,hour:60 xbar time.minute from trade //Removed grouped and test again update `#sym from `trade \ts:100 select last price by hour:60 xbar time.minute, sym from trade \ts:100 select last price by sym,hour:60 xbar time.minute from trade