Timescale Inc. Launches New Extensions to Boost PostgreSQL for AI Applications

Apps & Games / Timescale Inc. Launches New Extensions to Boost PostgreSQL for AI Applications
06 Jul 2024

Enhancing PostgreSQL for AI Applications

The new extensions, pgvectorscale and pgai, empower PostgreSQL, an open-source relational database, to efficiently handle vector data retrieval. This capability is crucial for developing AI applications and specialized contextual searches. Vector databases enable AI developers to organize data into high-dimensional arrays based on contextual relationships. Unlike traditional relational databases, vector databases store data using contextual meanings, allowing for connections based on "nearest neighbor" relationships. For instance, a cat and a dog are closer in meaning (as household pets) than a cat and an apple. This contextual storage accelerates information retrieval during AI searches for semantic data such as keywords, documents, images, and other media.

Avthar Sewrathan, AI product lead at Timescale, explained to SiliconANGLE that while most data is stored in high-performance vector databases, not all data used by services resides in vector databases. Consequently, multiple data sources often coexist within the same environment.

"Everyone at every organization in the world is trying to integrate AI in some way, whether it’s building new applications that leverage large language model capabilities or reimagining existing applications," said Sewrathan. "So, when CTOs or engineering teams explore AI integration, they face a choice: use a separate vector database or utilize a familiar database. The motivation behind these extensions is to make Postgres a better database for AI."

Introducing pgvectorscale

The pgvectorscale extension builds on the existing open-source extension pgvector, enabling developers to create more scalable AI applications with higher performance embedding for search at lower costs. Sewrathan highlighted two key innovations in pgvectorscale: DiskANN and Statistical Binary Quantization. DiskANN can offload half of its search indexes to disk, typically stored in memory, with minimal performance impact, significantly reducing costs. Statistical Binary Quantization improves standard binary quantization, reducing memory usage.

Timescale’s benchmarks for pgvectorscale demonstrated that PostgreSQL could achieve 28x lower latency for 95% and 16x higher query throughput compared to the popular Pinecone vector database for approximate nearest neighbor queries at 99% recall. Unlike pgvector, written in C, pgvectorscale is developed in Rust, opening new opportunities for PostgreSQL developers to build vector support.

Introducing pgai

The pgai extension simplifies the development of search and retrieval-augmented generation (RAG) solutions for AI applications. RAG combines vector databases' strengths with large language models (LLMs) by providing real-time, authoritative information to reduce AI hallucinations—instances where AI confidently issues false statements. This technique is essential for building accurate and reliable AI applications. The initial release of pgai supports creating OpenAI embeddings quickly and generating OpenAI chat completions from models like GPT-4o directly within PostgreSQL.

OpenAI’s GPT-4o is the latest flagship model offering powerful multimodal capabilities, including real-time voice conversation and video understanding. Sewrathan emphasized that integrating vector capabilities into PostgreSQL creates a powerful "ease of use" bridge for many developers, as many businesses already rely on PostgreSQL or other relational databases.

"The ability to add vector storage and retrieval capabilities directly into PostgreSQL means developers can leverage their existing infrastructure while enhancing their applications with advanced AI functionalities," Sewrathan noted. "This approach not only simplifies the integration process but also reduces the learning curve associated with adopting new technologies."

As organizations worldwide continue to explore AI integration, Timescale's new extensions offer a promising solution for those looking to enhance their PostgreSQL databases with cutting-edge AI capabilities.

Update: 06 Jul 2024