« I'm in a hurry. Can multiple kdb processes write simultaneously to a splayed database? | Main | How do I split a list? »

How can I reorder column names of a splayed table on disk?

Modify the file .d in the splayed table directory. The contents are editable via operators get and set.

$ rlwrap q sp.q
KDB+ 2.7 2011.02.16 Copyright © 1993-2011 Kx Systems
(+(,`color)!,`blue`green`red)!+(,`qty)!,900 1000 1200
+`s`p`qty!(`s$`s1`s1`s1`s2`s3`s4;`p$`p1`p4`p6`p2`p2`p4;300 ..
s p qty
s1 p1 300
s1 p2 200
s1 p3 400
q)`:splaydir/ set sp
q)\ls -a splaydir
".d" // this is where the col names live
q)get `:splaydir/.d
q)`:splaydir/.d set reverse get `:splaydir/.d
q)get `:splaydir/.d

Verify with a fresh kdb instance:

$ rlwrap q splaydir
KDB+ 2.7 2011.02.16 Copyright © 1993-2011 Kx Systems
qty p s
300 0 0
200 1 0
400 2 0

See also: xcol and xcols faq

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
All HTML will be escaped. Textile formatting is allowed.