BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Amazon Aurora PostgreSQL Adds pgvector to Support Embeddings from Generative AI

Amazon Aurora PostgreSQL Adds pgvector to Support Embeddings from Generative AI

AWS recently announced that the PostgreSQL-compatible edition of Amazon Aurora now supports pgvector for vector storage and similarity search. Aurora is the latest managed PostgreSQL database supporting the open-source extension to store and search embeddings from machine learning models.

The pgvector extension simplifies the storage and effective searching of embeddings in existing Postgres databases, capturing the semantic meaning of text inputs. Shayon Sanyal, principal database specialist solutions architect at AWS, describes how to leverage pgvector on Aurora for natural language processing, chatbots, and sentiment analysis:

pgvector provides different capabilities that let you identify both exact and approximate nearest neighbors. It’s designed to work seamlessly with other PostgreSQL features, including indexing and querying. Using ChatGPT and other LLM tooling often requires storing the output of these systems, i.e., vector embeddings, in a permanent storage system for retrieval at a later time.

In the article, Sanyal shows how to build a simple interactive application using LangChain and Streamlit that lets users ask questions in natural language based on content in PDF files.

According to the cloud provider, the pgvector extension allows customers to build ML capabilities into e-commerce, media, and health applications. The new option adds to the capabilities of Amazon Aurora machine learning, which integrates Aurora with AWS ML services and offers the ability to create ML-based predictions using the SQL language. Stefan Borsje, co-founder at Glass, comments:

pgvector landed in Amazon Aurora, and it blows my mind how well similarity search performs (both speed + precision) on a reasonably sized dataset. Ordering hundreds of thousands of 512-dimensional vectors by cosine similarity in just ~10ms. What kind of magic is this?

Krishna Sarabu, senior database specialist solutions architect at AWS, explains how to build AI-powered search in PostgreSQL using SageMaker and pgvector:

After generating embeddings, an application or researcher can perform similarity searches within the vector space. Similarity searches over embeddings benefit various industry applications, including e-commerce, recommendation systems, and fraud detection. For example, systems can discern mathematical similarities between products or transactions to create relevant product recommendations or identify potentially fraudulent activity.

Word embeddings: words that are semantically similar are close together in the embedding space (Source: Building AI-powered search in PostgreSQL using Amazon SageMaker and pgvector)

Due to the popularity of generative AI and to compete with dedicated vector databases like Pinecone, different managed database services added support for pgvector. These services include Azure Database for PostgreSQL Flexible Server, Azure Cosmos DB for PostgreSQL, and Amazon RDS for PostgreSQL. Additionally, Google Cloud SQL for PostgreSQL and AlloyDB for PostgreSQL recently introduced support for the extension, as separately reported on InfoQ.

The pgvector extension is available on Aurora PostgreSQL 15.3, 14.8, 13.11, 12.15 and higher in all AWS regions. The documentation covers all the extensions currently supported, their versions, and how to work with PostgreSQL extensions and foreign data wrappers.

About the Author

Rate this Article

Adoption
Style

BT