cancel
Showing results for 
Search instead for 
Did you mean: 

cols t vs key flip value t

Mannix
New Contributor III
New Contributor III

At least twice in tick.q

key flip value t is used to get the columns names of the table t.

Would cols t not do the same job?

If so, surely key flip value t has a greater memory overhead.

1 ACCEPTED SOLUTION

SJT
Valued Contributor
Valued Contributor

Perhaps the author was trading memory for speed?

 

q)t:flip(`$'.Q.a)!26 10000000#26000000?1000
q)(cols `t)~key flip value `t
1b
q)\ts:10000 cols `t
12 528
q)\ts:10000 key flip value `t
2 880

One of the loveliest aspects of working in q is how easy it is to experiment like this!

 

View solution in original post

1 REPLY 1

SJT
Valued Contributor
Valued Contributor

Perhaps the author was trading memory for speed?

 

q)t:flip(`$'.Q.a)!26 10000000#26000000?1000
q)(cols `t)~key flip value `t
1b
q)\ts:10000 cols `t
12 528
q)\ts:10000 key flip value `t
2 880

One of the loveliest aspects of working in q is how easy it is to experiment like this!