KX Community

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

Home Forums kdb+ .Q.qp for splayed table

  • .Q.qp for splayed table

    Posted by darrenwsun on September 17, 2022 at 12:00 am

    The .Q.qp doc says 0b for splayed table, but on KDB 4.0 it’s actually 0. Is it a bug, or there is a new way to check if a table is splayed?

     

    q)`:./t/ set ([] v1:10 20 30; v2:1.1 2.2 3.3) 
    `:./t/ 
    
    q)l ./t 
    `t 
    
    q)0b~.Q.qp t x
    0b 
    
    q)0~.Q.qp t 
    1b

     

     

    darrenwsun replied 9 months, 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • sujoy

    Member
    September 17, 2022 at 12:00 am

    If you refer here: https://code.kx.com/q/basics/syscmds/#l-load-file-or-directory

    • serialized object, deserializes it into memory as variable name
    • directory of a splayed table, maps the table to variable name, without loading any columns into memory

    When you are running, l .t -> you are loading the object as t in root. Thus .Q.qp is showing t as 0

    % ls -lrth t
    total 16
    -rw-r–r–  1 sujoyrak**bleep**  staff    40B Sep 17 17:20 v1
    -rw-r–r–  1 sujoyrak**bleep**  staff    40B Sep 17 17:20 v2

    % q 
    KDB+ 4.0 2021.07.12 Copyright (C) 1993-2021 Kx Systems
    q)l .
    q)a
    ,`t
    q).Q.qp t
    0b
    q)l t
    `t
    q).Q.qp t
    0

     

  • darrenwsun

    Member
    September 17, 2022 at 12:00 am

    Thanks @sujoy13. What confused me is “directory of a splayed table”, which I interpreted as directory t as in your example.

    A follow-up question: what is the real runtime difference between l . and l t for this particular example? The latter form also maps the table without copying data from disk to memory. By the way t is layed out on the disk, it is a splayed table…

Log in to reply.