Skip to main content

Command Palette

Search for a command to run...

Introduction for Vector databases for RAG

Updated
•4 min read•View as Markdown
Y

Developer | Adept in software development | Building expertise in machine learning and deep learning

Introduction to Vector database and Chroma DB

Quick memory notes

Vector database types

  • In-memory

    • Store vectors in RAM for very fast reads and writes

    • Suited for real-time analytics and recommendations

    • Examples: RedisAI, TorchServe

  • Disk-based

    • Persist vectors on disk for data sets larger than memory

    • Use indexing and compression to speed retrieval

    • Examples: Annoy, Milvus, ScaNN

  • Distributed

    • Spread vectors across multiple nodes for horizontal scale and fault tolerance

    • Good for massive data sets and high throughput

    • Examples: FAISS, Elasticsearch with vector plugin, Dask-ML

  • Graph-based

    • Represent vectors as properties in graph nodes and edges

    • Capture complex relationships for graph analytics

    • Examples: Neo4j, Amazon Neptune, TigerGraph

  • Time-series

    • Handle time-stamped vectors for temporal patterning and anomaly detection

    • Examples: InfluxDB, TimescaleDB, Prometheus

Dedicated vector databases vs databases that support vector search

  • Dedicated vector databases

    • Built for vector storage, indexing, querying and analysis

    • Use specialised structures and techniques like inverted indexes, product quantisation and locality-sensitive hashing

    • Support nearest neighbour, similarity and distance operations

    • Optimised for speed and high dimensional vectors, scale across clusters

    • Tunable indexing and search parameters for use case fit

    • Examples: FAISS, Annoy, Milvus

  • Databases that support vector search

    • General databases or processing frameworks with vector features or plug-ins

    • Store vectors as blobs, arrays or user-defined types

    • May offer standard or custom indexes and integrations for vector operations

    • Can execute similarity search via add-ons or external libraries

    • Typically less optimised than dedicated systems, evaluate performance and scale for needs

    • Examples: SingleStore with IBM watsonx.ai support, Elasticsearch vector add-on, PostgreSQL (PostGIS noted), MySQL vector indexes, RedisAI in memory, MongoDB, Apache Cassandra

Where they are used

  • Recommendation systems, information retrieval, social network analysis, knowledge graphs, monitoring, forecasting and anomaly detection

Application of Vector DB

How companies and individuals use vector databases – quick memory notes

  • Image and video analysis

    • Store high-dimensional feature vectors for colour histograms, texture descriptors and deep embeddings

    • Run similarity search to find, summarise and recommend images or videos

    • Real-time processing with horizontal scalability for surveillance, object recognition and live event analysis

    • Example: photo app keeps embeddings of user photos to suggest similar images for tagging or album organisation

  • Recommendations

    • Embed items and use nearest neighbour search for personalised suggestions

    • Scale to high concurrency with fast indexing and query processing

    • Cross-domain suggestions via shared embedding spaces

    • Example: streaming service uses movie embeddings to recommend related titles after a viewing

  • Geospatial and location-based services

    • Use R-tree or quadtree indexing for addresses, polygons and GPS points

    • Support spatial queries like proximity, range and spatial joins

    • Real-time geospatial analytics: spatial clustering, pattern recognition for traffic, fleet management, dynamic routing and hotspot detection

    • Example: navigation app queries a vector store of restaurant GPS locations to list nearby options

  • Social and marketing insights

    • Distributed storage and parallel processing for big data and simultaneous queries (SEO, user profiles)

    • Optimised caching and query execution plans to reduce latency and speed trend analytics for influencers and advertisers

    • Autoscaling and dynamic resource allocation for performance and cost control in cloud and on-premise environments

    • Example: social platform scales databases as users grow, tracks interests and clicks without slowing response times

  • Key takeaways

    • Vector databases enable feature extraction, similarity search and real-time processing for media

    • Embeddings power fast, scalable, cross-domain recommendations

    • Geospatial processing supports GPS services, fleet management and real-time traffic routing

    • Social and marketing platforms benefit from horizontal scalability, low latency and adaptive resource usage