Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I set column attributes for a kdb partitioned table?

Tags:

kdb

Is it possible to set column attributes for a partitioned table?

q)h "update `g#ticker from `pmd"
'par
q)h "update `s#ts from `pmd"
'par
q)

Should I set the attributes on the memory table, before I run the partitioning? Will the attributes be preserved after the partitioning?

like image 568
Robert Kubrick Avatar asked Jun 04 '13 18:06

Robert Kubrick


2 Answers

Take a look at the setattrcol in dbmaint.q. This script is very very useful when working with partitioned databases.

like image 155
user1895961 Avatar answered Nov 14 '22 11:11

user1895961


In order for the partitions on disk to be sorted, you need to iterate through the partitions and use xasc as follows: for each partition .. assuming you have a quote table partitioned by date to sort by `timestamp

{`timestamp xasc `$":./2014.04.20/quote/"}

Once you've finished sorting each partition, the s attribute will appear ontimestamp column..

q)meta quote
  c        | t f a
  ---------| -----
  date     | d    
  timestamp| p   s
  pair     | s    
  side     | c    
  ...
like image 5
David Hall Avatar answered Nov 14 '22 12:11

David Hall