2015.07.26 03:22 AM
2015.07.26 04:30 AM
2015.07.26 05:36 AM
http://code.kx.com/wiki/Contrib/dbmaintdotq
Use at your own risk 😉
2015.07.26 05:45 AM
// some random data
n:1000;
mytbl:([]id:n?0Ng;name:n?`foo`bar`baz;sz:n?50;px:n?100.0);
.Q.dpft[`:db;2015.07.25;`name;`mytbl];
mytbl:([]id:n?0Ng;name:n?`foo`bar`baz;sz:n?50;px:n?100.0);
.Q.dpft[`:db;2015.07.26;`name;`mytbl];
// load hdb
\l db
// select data from mytbl table
show select count i, t:wsum[sz;px] by date, name from mytbl
// get rid of name=`bar in 2015.07.25 partition
idx:1+(select i from mytbl where date = 2015.07.25, name = `bar)`x
// drop from the list (name) and enumerate sym
`:./2015.07.25/mytbl/name set `sym?last idx _ get `:./2015.07.25/mytbl/name;
// drop indexes from other columns
`:./2015.07.25/mytbl/id set last idx _ get `:./2015.07.25/mytbl/id;
`:./2015.07.25/mytbl/px set last idx _ get `:./2015.07.25/mytbl/px;
`:./2015.07.25/mytbl/sz set last idx _ get `:./2015.07.25/mytbl/sz;
// bar data has been removed from hdb
show select count i, t:wsum[sz;px] by date, name from mytbl
2015.07.27 04:28 AM
2015.07.26 06:12 AM
EMEA
Tel: +44 (0)28 3025 2242
AMERICAS
Tel: +1 (212) 447 6700
APAC
Tel: +61 (0)2 9236 5700
KX. All Rights Reserved.
KX and kdb+ are registered trademarks of KX Systems, Inc., a subsidiary of FD Technologies plc.