Robert Kubrick
Robert Kubrick

Reputation: 8713

How do I unload a kdb partitioned database?

I loaded (mapped) a partitioned database with the \l command. How can I unmap the database? This can be useful for a number of reasons, like loading a different db with the same name or freeing some system memory.

Upvotes: 3

Views: 1269

Answers (3)

Rachel Gallen
Rachel Gallen

Reputation: 28563

You can do a Q.gc[] call to the garbage collector

Upvotes: 2

nashar1
nashar1

Reputation: 1087

\l does not increase the memory usage by q significantly. its the variables you create and computations you run which consume the memory. so as mnestor said

delete from `. .Q.gc[]

should solve your problem of name conflict and memory management. To avoid deleting something which might be needed, just move it to another namespace. E.g .n.somethinguseful

Upvotes: 1

mnestor
mnestor

Reputation: 319

There is no command to do this. You could manually delete all the variables that were created when the database was mapped. So delete sym, date (if your database contains a date partitioned table) and all the tables that were loaded.

/ delete sym, date, quote and trade from the default namespace
delete sym, date, quote, trade from `.

/ or if you want to delete everything in the default namespace
delete from `.

After doing this you could call .Q.gc[] - to return memory to the os. Not pretty, but I think it's the only way.

Upvotes: 6

Related Questions