What Is a Vector Database? How It Works and When You Need One
Understand embeddings, similarity search, indexes and filters, then decide when pgvector is enough and when Pinecone or Qdrant fits.
Published

You can add meaning-based search without adopting another database: PostgreSQL, the relational database you may already run, can do it with the pgvector extension. The answer to “what is a vector database” starts with 3 separate jobs: represent content as numbers, retrieve similar records, and restrict the results to eligible data. Buy a separate service when its retrieval capabilities or operating model solve a requirement your existing setup cannot meet.
The database capabilities below were verified against the makers' live documentation on 20 October 2026. The support example is illustrative; it is not a benchmark or a reported deployment.
What is a vector database and how does it work?
A vector database stores numerical representations of content and finds records whose representations are close to a query. That lets a search for “I cannot sign in” find an article about account recovery even when the words differ. It can be a dedicated service or a capability added to an existing database. Pinecone's explanation describes the storage, indexing and search functions.
Think of an embedding as an address on a map of related ideas. An embedding model, software trained to turn content into numerical representations, places related items near one another. The database stores those addresses and finds nearby items. The map is learned, so “nearby” is useful evidence of relevance, not a guarantee.
An embedding is the list of numbers. A dimension is one position in that list. You normally cannot label each position “billing,” “security” or “customer happiness”; meaning is distributed across the representation. Text, pictures and audio can each be embedded by a suitable model. Qdrant's vector documentation explains this representation.
What the database stores
A useful search record needs more than an embedding. Keep a stable ID, the vector, and metadata, ordinary fields such as product, language, tenant and publication status. Preserve the source text alongside the record or an identifier that lets the application fetch it. An embedding alone does not give the answer generator the original passage to quote. Pinecone's record and document definitions describe the distinction between searchable representations and associated fields.
For a support article, the search record might represent one self-contained passage rather than the whole page. This passage is a chunk. Keeping the recovery instructions together is more useful than cutting halfway through the exception that tells a customer what to do next.
Vector database visualization
Distance expresses similarity in the model's space. It is not physical distance, and a drawing can only illustrate the idea.

The embedding model determines this map. Changing the database does not automatically improve where it places a confusing query. Start model selection with the best embedding models comparison, then evaluate on the questions your users ask.
Similarity search and indexes
A query goes through the compatible embedding model and configuration used for the stored content. Follow the model's query and document modes where it distinguishes them. The database compares the resulting vector using the appropriate distance metric, a rule such as cosine distance or Euclidean distance, and returns the nearest records. Pinecone's indexing guide documents this flow.
An index is an extra structure that helps search avoid comparing against every stored vector. Exact search finds the nearest records under the chosen metric. Approximate nearest-neighbor search, often shortened to ANN, can skip some true nearest neighbors to reduce search work. Recall here measures how many of those nearest neighbors the approximate search recovers; it does not measure whether an answer is true.
Two common index families are HNSW, a graph of neighbor connections, and IVFFlat, groups of vectors whose nearest groups are searched. The pgvector README documents both. For your product, the question is whether the saved search work is worth the relevant results you might miss.
Metadata filtering
Filters decide which records are eligible; similarity orders the matches. A query might require product=workspace, language=en and status=published, plus the customer's permitted tenant. These are explicit conditions, not concepts to hope an embedding understands. Pinecone's metadata-filtering guide shows how filters narrow a search.
Your server must derive the tenant and permissions from authenticated identity. A filter supplied by a browser or an agent is not, by itself, authorization. Before private passages reach an answer model, confirm that the user can still access their source records.
Vector database example: support articles to answer search
A support search should retrieve the passage that resolves the customer's problem, even when the customer does not know its title.
Consider 3 hypothetical articles:
- Account recovery: “If your authenticator device is unavailable, use a saved recovery code. If you have no recovery code, contact support.”
- Billing address: “Change the address used on future invoices from billing settings.”
- Invite a teammate: “An administrator can send a workspace invitation from member settings.”
The customer asks: “I lost my phone and cannot get past the login code.” Account recovery is the intended match. That is a target for your evaluation, not a claim that every embedding model will rank it first.
Prepare the source passages
Keep each answerable passage with its article ID, title, source location and current permissions. Avoid separating an instruction from its qualifying exception.
Embed and store
Run each passage through your chosen embedding model. Save its vector with the source ID and metadata, including product, language and publication status. Keep the model configuration so future queries use compatible representations.
Search within the eligible content
Embed the customer's question, apply the product and permission restrictions, and retrieve nearby records. Inspect the retrieved passages, not just their similarity scores.
Return evidence or compose an answer
A search interface can show the matching article directly. An answer interface can give its passage to a language model with instructions to cite the source and acknowledge when the evidence is insufficient.
A plausible answer from that supplied passage is: “Use a saved recovery code. If you do not have one, contact support.” The answer must not invent a way around account security because the customer sounds frustrated.
How to create a vector database for RAG
Build retrieval before adding answer generation. Retrieval-augmented generation, or RAG, means supplying retrieved material to a language model when it writes an answer. The vector database finds candidate evidence; the language model composes the response. These remain separate responsibilities even if a vendor packages them together. Pinecone's RAG explanation describes this relationship.

For the support product, first verify that recovery questions retrieve the recovery passage. Then check whether the generated response stays within that passage. If the wrong document arrives, changing the answer prompt cannot reliably repair retrieval.
An agent may decide to search again, reformulate a question or consult another source. That adds a control loop around retrieval; it does not change what vectors store. The agentic RAG guide covers that next architectural step.
When PostgreSQL is enough, and when a managed service earns its bill
Keep vectors in your existing database when retrieval meets your product's requirements there. Separate them when search needs independent capacity, specialized retrieval behavior or an operating model your team cannot reasonably supply. This is an architectural recommendation derived from the documented behavior below, not a measured ranking.
For the broader product comparison with prices, use best vector database. The decision here is what your application needs to do.
pgvector: keep retrieval beside the application data
pgvector adds vector similarity search to PostgreSQL while retaining SQL joins, which combine related records, and transactions, which commit changes together. That makes it a strong starting point for a SaaS product whose documents and account permissions already share a database. Its README documents the capabilities.
The architectural benefit is one place to associate a passage with its owner, status and source. You still need to regenerate embeddings when content changes, but you can avoid copying permission metadata into another database just to launch search.
The wall is filtered approximate retrieval and shared resources. pgvector defaults to exact search. With approximate indexes, filters are applied after scanning index candidates, so a query can return too few eligible rows. The README describes iterative scans, filter-column indexes, partial indexes and partitioning as options. Read the filtering guidance.
For example, a permission filter might exclude most initial candidates. Treat that as a query-design problem before declaring the database inadequate. Then measure whether solving it consumes more memory or search time than the product can tolerate alongside its ordinary transactions.
Choose pgvector when this arrangement meets your requirements and your team can operate PostgreSQL. Do not migrate merely because a prototype grew; migrate when you can name the requirement that remains unmet.
Pinecone: pay for managed retrieval infrastructure
Pinecone fits when you want a separate retrieval service without operating its underlying infrastructure. Its architecture documentation describes a managed service with serverless infrastructure, where Pinecone runs the underlying capacity, and independently scaling read and write paths.
Its overview documents supplied vectors, integrated embedding options, metadata filters and namespaces, logical partitions that can separate tenants. The practical fit is a small product team that needs independent search capacity and would otherwise have to own another database deployment.
The wall is the application boundary you still own. Your product must send content changes, deletes and permission updates into the service and detect failures in that synchronization. Managed infrastructure does not decide whether an article is current or a user is authorized.
Pinecone also documents eventual consistency: changed records can take time to become visible to queries. Use its data-freshness guidance when designing “upload, then immediately ask” experiences. Do not treat a successful write as proof that a subsequent search reflects it.
Pinecone earns its bill when handing infrastructure operation to a vendor and separating search from application traffic are concrete needs. It is harder to justify when the existing database already meets those needs and synchronization becomes the largest new problem.
Qdrant: a dedicated engine with deployment choices
Qdrant offers a dedicated vector search engine in open-source and managed-cloud forms. Its overview describes points containing vectors and payload, the additional fields used to carry context and filter results.
For a knowledge product combining tenant, document status and access-group conditions, its filtering documentation and indexing guide deserve attention. Payload indexes help evaluate filters and plan queries; filterable HNSW adds connections associated with indexed payload values.
The wall is deliberate index design plus ownership of another store. Qdrant recommends creating payload indexes before ingestion so the vector graph can include those filter-aware connections. Adding them later can require rebuilding the HNSW index for that benefit. Self-hosting also leaves the deployment with your team; Qdrant Managed Cloud supplies managed clusters, scaling, monitoring and backups.
Evaluate Qdrant when its filtering behavior or deployment choice addresses a specific requirement. A dedicated engine still needs the same source-update and deletion discipline as any other separate search store.
The limits that matter before you ship
Measure retrieval with the filters and updates your users will experience. A fast search across every document says little about a customer who may see only a small eligible subset.
Vector width must fit the index representation. The pgvector README lists a 2,000-dimension limit for vector indexes using HNSW or IVFFlat, and 4,000 for halfvec, its half-precision representation. These are index limits, not universal limits on stored rows. Check compatibility before committing to an embedding output. pgvector index documentation.
Recall and answer quality are different checks. Compare approximate results with exact nearest neighbors to diagnose index loss. Separately, label whether the retrieved passages answer the user's question. An exact search can faithfully return the wrong evidence if the model represents the task poorly.
Freshness includes removal. Editing an article should replace obsolete passages; deleting it should remove their search records. A permission revocation must also stop those passages from reaching the model. Test these transitions as carefully as successful ingestion.
Usage includes work outside search. Re-embedding revised content, maintaining indexes and synchronizing source records remain part of the system. The useful capacity limit is the one your actual workload hits, not an isolated count of vectors.
What is overhyped about vector databases?
The strongest overclaim is that adding vector storage gives an application reliable memory. It gives you a way to retrieve stored representations. You still decide what to remember, who may access it, when it expires and how a correction overrides an older record.
A second overclaim is that meaning-based search replaces exact matching. Product codes, error strings and names often need lexical retrieval, which matches terms. Hybrid search combines that signal with semantic retrieval. Qdrant's overview explicitly notes that dense vectors can miss technical terms and identifiers.
A third is that similarity establishes truth. A confident passage can be obsolete, unauthorized or simply about a related problem. Keep the evidence attached to the result, and give the application a way to say it does not have enough support for an answer.
For a founder, this means funding retrieval evaluation before infrastructure expansion. For a developer, it means testing the whole path from source update to authorized answer. For an operator, it means assigning ownership of indexing failures and stale content, even when the database itself is managed.
How to create a vector database: your Monday move
Start with the database you already run, an answerable support collection and a written acceptance rule. If PostgreSQL is available, check that your provider supports pgvector and enable the extension through its supported installation process.
Choose the embedding model and compatible vector representation. Store each passage with its source ID and permission fields. Start with exact retrieval where practical to establish a baseline, then add an approximate index only when measured search time requires it.
Collect actual support questions with their intended source passages. Include paraphrases, exact error strings, restricted articles, recently edited content and questions the documentation cannot answer. Check both relevance and exclusion: returning a useful passage and withholding an unauthorized one are separate requirements.
Set acceptable search latency, retrieval quality and update visibility for your product. If the current database passes, ship there. If it fails, take the failing queries and operational requirements to a Pinecone or Qdrant evaluation. That gives a managed service a concrete job to earn.
Frequently asked questions
What are the uses of vector databases in AI?
They support meaning-based search, retrieval for generated answers, similarity-based recommendations and retrieval of stored context. The embedding model must represent the kind of similarity the application needs.
Why would I need a vector file?
A vector graphics file describes shapes and paths for artwork. That is a different use of “vector” from the numerical embeddings discussed here. An AI search feature does not require a vector graphics file.
What are examples of vector data?
An embedding of a support passage, a product image or an audio clip is vector data: numbers representing the item for a particular similarity task. These are different from geographic or drawing vectors used in other fields.
What is the definition of a vector in data science?
A vector is an ordered collection of numbers. In an embedding system, those numbers represent an item so that mathematical comparisons can help identify related items.
Is SQL a vector database?
SQL is a query language. PostgreSQL with pgvector is an example of a relational database that can also store and search vectors. A separate vector service is an architectural choice, not a requirement imposed by AI.
What are the top 3 vector databases?
For the decision covered here, evaluate pgvector when you already operate PostgreSQL, Pinecone for managed retrieval infrastructure, and Qdrant for a dedicated engine with open-source and managed deployment options. These are scenario-based starting points, not a benchmark ranking.
Does Chatgpt use a vector database?
Do not infer a particular database from a conversational interface or a memory feature. This article does not establish ChatGPT's internal storage architecture. For your own product, choose retrieval storage from its requirements rather than an assumed implementation of another service.
What is the best free vector database?
Start by evaluating open-source pgvector if you already have PostgreSQL; consider open-source Qdrant if you need a dedicated engine. Neither choice removes hosting and operational work. The existing data model and retrieval requirements matter more than the software label.
Which database does AI use?
There is no single required database. An application can use a relational store for accounts and transactions, a vector search capability for similarity, and source storage for documents. These capabilities may share a system or live in separate services.
What is a vector database in AI?
It is the storage and retrieval component that searches numerical representations of content. It supplies relevant records to an AI application; it does not, by itself, train the model or decide whether an answer is correct.
Join the newsletter for practical guides to building AI products.
- Published
- Category
- Build
- Language










