I have a KDB/Q databse which has around ~2M records per day consuming about ~2G of memory. At end of day it runs some reporting stuff doing joins between the tables and outputting result into files on disk. During the computation the memory usage grows to ~15G. My problem is that once this operation finishes the memory is never released back and until the DB is restarted it consumes all the 15G of memory.
I would like to tell KDB to unload some tables from memory (not drop them though) but I don't want to restart the DB since some other apps are still connecting to it.
Is there a way to tell KDB to unload something from memory?
EDIT:
If anyone finds it interesting I suggest to have a look on .Q.gc[]
for KDB 2.5+, looks promising.
Here is the sum up of my research:
.Q.gc[]
call which is on-request call to garbage collector (KDB uses ref. counting btw.)For anyone trying this in future the easiest way would have been to:
As mentioned by the above posters newer versions of KDB free up memory better but not perfect.
There's a good article on our company website that details KDB+ Memory Management: http://timestored.com/kdbGuides/memoryManagement
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With