Search code examples
kdb

In KDB, is their a straightforward way of doing `more` for lists and tables?


I frequently have to explore the actual data by looking through it.

The problem I encounter is:

til 100
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ..
q)

Everything gets truncated in the REPL.

Is there an easy way to explore data in KDB? (I'm using the REPL in combination with vim-cmdline)


Solution

  • Out of the box KDB+ doesn't offer this ability.

    If you want to display more data on the screen can expand your console size (up to a certain limit) via the \c system command or -c command line parameter
    https://code.kx.com/q/basics/syscmds/#c-console-size

    You could also use in-built functions like _ (drop), sublist, or ? (find) to locate and display particular data of interest.

    q)l:til 100
    q)(-5+l?40;11) sublist l  // Show 5 records either side of 40
    

    There are also some IDEs for KDB+ that might help:
    http://www.qinsightpad.com/
    https://github.com/CharlesSkelton/studio
    https://code.kx.com/developer/