Skip to Content

Pinecone (Managed Serverless Vector DB)

When to use

Offload vector infra to a managed service — low ops overhead, predictable latency, pay per usage.

Analogy

A fully-managed warehouse. You ship pallets (vectors); they shelf, index, retrieve. No racking, no forklifts, no fire extinguishers.

Data-flow diagram

  pinecone.create_index('docs', dimension=1536, metric='cosine')
  index.upsert(vectors=[(id, vec, metadata)])
  index.query(vector=q, top_k=5, include_metadata=True)
  index.delete(ids=[...])

Deep explanation

Pinecone is the most popular managed vector database. Serverless tier scales to zero; pod-based tier gives dedicated capacity. Common operations: create_index, upsert, query, delete, fetch_by_id. Metadata filtering happens inside Pinecone. Use it when you want zero operational overhead and predictable p99 latency.

Examples

Example 1

from pinecone import Pinecone, ServerlessSpec
pc = Pinecone(api_key='...')
pc.create_index('docs', dimension=1536, metric='cosine',
               spec=ServerlessSpec(cloud='aws', region='us-east-1'))

Serverless spec eliminates capacity planning; you pay per read and write.

Example 2

index = pc.Index('docs')
index.upsert(vectors=[('chunk-1', vec, {'source':'pdf','tenant':'acme'})])
print(index.query(vector=q, top_k=5, include_metadata=True, filter={'tenant':'acme'}))

Metadata filter is server-side; filter and vector query happen in one round-trip.

Example 3

# namespace isolation
index.upsert(vectors=[...], namespace='tenant-acme')
index.query(vector=q, namespace='tenant-acme', top_k=5)

Namespaces are isolated indexes within one index — per-tenant isolation without per-tenant index.

Common mistake

Embedding models with mismatched dimensions. Pinecone index is fixed-dimension; switching embed models triggers a re-create.

Key takeaway

Pinecone is the easy-on ramp. Serverless scales, namespaces isolate tenants, metadata filtering is server-side. Pin your embed-model dimension.

Production Failure Playbook

Failure scenario 1: dim-mismatch

Failure scenario 2: metadata-filter-no-zeros