KX Community

Find answers, ask questions, and connect with our KX Community around the world.
KX Community Guidelines

Home Forums kdb+ cols t vs key flip value t

  • cols t vs key flip value t

    Posted by mannix on March 18, 2022 at 12:00 am

    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.

    mannix replied 9 months, 1 week ago 2 Members · 1 Reply
  • 1 Reply
  • Laura

    Administrator
    March 18, 2022 at 12:00 am

    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!

     

Log in to reply.