All Collections
Milvus
Concepts
How does Milvus work with PostgreSQL?
How does Milvus work with PostgreSQL?
Bakul Banthia avatar
Written by Bakul Banthia
Updated over a week ago

Milvus can be integrated with PostgreSQL, a popular open-source relational database management system, to combine the capabilities of both databases, allowing you to manage and query structured data in PostgreSQL alongside high-dimensional vector data in Milvus. Here's how the integration typically works:

  • Installation and Configuration:

    • First, you need to install and configure both Milvus and PostgreSQL on your system or server. Make sure you have both databases up and running.

  • Data Import and Synchronization:

    • In Milvus, you would store your high-dimensional vector data.

    • In PostgreSQL, you can manage structured data, such as metadata associated with the vectors.

    • To associate structured data in PostgreSQL with vectors stored in Milvus, you would typically use a unique identifier or foreign key. For example, you might have a PostgreSQL table that stores image descriptions and associates each image's unique ID with a vector stored in Milvus.

  • Querying and indexing:

    • You can use PostgreSQL for structured data querying and Milvus for vector similarity searches.

    • When you want to perform a query that combines structured data and similarity search, you would typically run two separate queries, one against PostgreSQL and the other against Milvus. You could use the ID or foreign key to link the results from both queries.

  • Application Integration:

    • Your application or software interacts with both databases, sending requests to PostgreSQL for structured data and to Milvus for similarity searches.

    • Application logic is responsible for orchestrating the queries and combining results if necessary.

  • Scalability and Optimization:

    • Depending on your specific use case, you may need to optimize and scale both databases accordingly. PostgreSQL can be clustered or sharded for scalability, and Milvus can be deployed on multiple servers for better performance and data distribution.

It's important to note that this integration between Milvus and PostgreSQL is often used when you need to manage metadata or structured data alongside high-dimensional vectors. For example, in image retrieval systems, you may store image metadata in PostgreSQL and the vectors representing those images in Milvus. By linking the metadata and vectors using unique identifiers, you can efficiently search and retrieve images based on both their content (vectors) and associated metadata (structured data).
The specific implementation details and query orchestration in your application will depend on your use case and how you choose to structure and manage your data in both databases.

Did this answer your question?