Before we can query the data that is stored in the collection, we need to ensure that the collection is loaded into the memory.
Therefore, before we can query the data that is stored in the collection, we need to load the collection into the memory.
However, once we are done in performing all the operations on the collection, we need to release the collection from the system memory to the system storage.
In this tutorial, we will learn how to release a loaded collection using the Milvus CLI and the Attu server manager.
How Does the Collection Loading Works?
Before we get to the commands on loading the Milvus collection, let us explore what exactly happens during the collection load.
Loading a collection involves loading the metadata that is associated with the collection such as the schema, indexing configurations, and other settings. In addition, it involves loading the vector data from the storage system into the memory for quick and efficient data query and processing.
Creating a Milvus Collection
Before learning how to load and release a Milvus collection, let us start by setting up a sample Milvus collection for demonstration purposes.
Start by opening the Milvus CLI with the following command:
Next, login to your Milvus instance with the following command:
For example, the following command logs into a locally hosted Milvus instance on the default port and alias:
Output:
+---------+---------------------+
| Address | 192.168.100.2:19530 |
| User | |
| Alias | default |
Once logged in, we can create a sample Milvus collection as shown in the following command:
The given command should create a simple collection called “film” which we can use for demonstration purposes.
Load a Collection in Milvus
The CLI provides us with a set of commands that are easy to use which allows us to quickly and efficiently manage the database from a CLI interface.
To load a database in Milvus, we can use the load command as shown in the following syntax:
Where -c denotes the collection name and -p denotes the partition name.
NOTE: The “load” command allows us to load a collection or a partition to memory.
For example, we can run the following query to load the “film” collection into the memory.
The previous command loads the “film” collection into the memory and allows you to search the stored data.
+-------------------+----------+---------+
| Collection Name | Loaded | Total |
+===================+==========+=========+
| film | | |
+-------------------+----------+---------+
NOTE: The command may require you to create an index on your target collection.
To learn more about collection loading in Milvus, check the tutorial on https://linuxhint.com/milvus-load-collection.
Release a Collection Using the Milvus CLI
To release a collection, we can use the “release” command in the Milvus CLI as shown in the following syntax:
Where the -c parameter denotes the collection name and the -p option specifies the partition name.
For example, to release the film collection, we can use the following command:
Release a Collection Using Attu
If you are using the Attu manager, you can release a collection by navigating to the “loaded collections” pane on the left-hand pane.
This should list all the loaded collections in the server. Next, locate the database that you wish to release and click the “release” icon.
Upon a successful release of collection, you should see a notification which indicates that the collection has been released from the memory.
Conclusion
We explored how we can use the Milvus CLI to load a database collection. We also learned how to use the Milvus CLI and the Attu manager to release a collection from the memory.