Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete rows selectively from a kdb partitioned database?

Tags:

kdb+

I want to remove some rows from a partitioned database table, but this query won't work:

delete from myPartTable where date=2013.05.30,col1<>"A"

I'd rather not load the whole table into memory, remove from the rdb, and then write back to disk. Can I remove from the disk table directly?

like image 877
Robert Kubrick Avatar asked Nov 19 '25 17:11

Robert Kubrick


1 Answers

kdb by itself does not provide an easy method of manipulating partitioned tables. Two options:

  1. To reduce memory usage get the indices of the rows you want to delete. Go through on a per column basis and delete. This is the standard practice when reducing memory usage for partitioned database operations.

  2. Maintain a column that marks whether that row is deleted update that boolean as necessary to mark deletions. This would give faster deletions at the cost of slowing every select that would have to filter on where not deleted. At a later time, actually remove the rows.

like image 56
Ryan Hamilton Avatar answered Nov 22 '25 04:11

Ryan Hamilton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!