Pinecone
Vector Database
A vector database service. Specialized for real-time similarity search.
Vector Database
A vector database service. Specialized for real-time similarity search.
Pinecone is a fully managed cloud vector database that stores vector embeddings and performs similarity search in real time. Founded in 2019, it is widely used as core infrastructure for AI applications such as RAG (Retrieval-Augmented Generation), semantic search, and recommendation systems.
Pinecone uses ANN (Approximate Nearest Neighbor) algorithms to deliver millisecond-level response times even across billions of vectors. With HNSW (Hierarchical Navigable Small World) graph-based indexing, it achieves high recall and fast speed at the same time.
Its key features include metadata filtering, multitenancy through namespaces, hybrid search (vector + keyword), and real-time index updates. With a serverless architecture, it scales automatically, and you pay only for what you use.
In practice, Pinecone integrates easily with LLM frameworks such as LangChain and LlamaIndex. Used together with embedding models from OpenAI, Cohere, Hugging Face, and others, it can implement a variety of AI features such as document search, chatbot memory, and image search.
from pinecone import Pinecone, ServerlessSpec
from openai import OpenAI
# 초기화
pc = Pinecone(api_key="your-pinecone-api-key")
openai_client = OpenAI(api_key="your-openai-api-key")
# 인덱스 생성 (최초 1회)
index_name = "my-rag-index"
if index_name not in pc.list_indexes().names():
pc.create_index(
name=index_name,
dimension=1536, # text-embedding-3-small 차원
metric="cosine",
spec=ServerlessSpec(cloud="aws", region="us-east-1")
)
# 인덱스 연결
index = pc.Index(index_name)
# 임베딩 생성 함수
def get_embedding(text):
response = openai_client.embeddings.create(
model="text-embedding-3-small",
input=text
)
return response.data[0].embedding
# 문서 업서트 (삽입/업데이트)
documents = [
{"id": "doc1", "text": "Pinecone은 벡터 데이터베이스입니다.", "category": "database"},
{"id": "doc2", "text": "RAG는 검색 증강 생성을 의미합니다.", "category": "llm"},
{"id": "doc3", "text": "임베딩은 텍스트를 벡터로 변환합니다.", "category": "ml"}
]
vectors = []
for doc in documents:
embedding = get_embedding(doc["text"])
vectors.append({
"id": doc["id"],
"values": embedding,
"metadata": {"text": doc["text"], "category": doc["category"]}
})
index.upsert(vectors=vectors, namespace="documents")
# 유사도 검색
query = "벡터 DB란 무엇인가요?"
query_embedding = get_embedding(query)
results = index.query(
vector=query_embedding,
top_k=3,
include_metadata=True,
namespace="documents"
)
for match in results.matches:
print(f"Score: {match.score:.4f} | {match.metadata['text']}")
# 메타데이터 필터링 검색
filtered_results = index.query(
vector=query_embedding,
top_k=3,
include_metadata=True,
filter={"category": {"$eq": "database"}},
namespace="documents"
)
# 인덱스 통계 확인
stats = index.describe_index_stats()
print(f"총 벡터 수: {stats.total_vector_count}")
Pinecone Pricing Plans as of January 2025
| Plan | Minimum Monthly Cost | Storage | Write Units | Read Units |
|---|---|---|---|---|
| Starter (Free) | $0 | 2GB | 2M | 1M |
| Standard | $50 | $0.33/GB | $4/1M | $16/1M |
| Enterprise | $500 | $0.33/GB | $6/1M | $24/1M |
| Dedicated (BYOC) | Custom | Custom | Custom | Custom |
Key Features by Plan
"I think Pinecone would be a good choice as the vector store for the RAG pipeline. Since it's serverless, the initial setup is simple, and its official integration with LangChain works well, so we can speed up development. Let's run a PoC on the Starter plan first."
"What's the difference between Pinecone and other vector DBs?" - "Pinecone is a fully managed SaaS, so there's no need to manage infrastructure, and it scales automatically. On the other hand, Milvus and Qdrant can be self-hosted, which is advantageous when data sovereignty matters. In terms of cost, self-hosting can be cheaper at larger volumes."
"Pinecone's hybrid search uses both dense and sparse vectors. Combining keyword matching such as BM25 with semantic search significantly improves search quality, especially in domains with a lot of specialized terminology."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free
If the dimension set when creating the index differs from the actual embedding dimension, upserts will fail. OpenAI text-embedding-3-small is 1536, ada-002 is 1536, and text-embedding-3-large is 3072. When you change models, you must create a new index.
On the Starter plan, indexes are automatically paused after 3 weeks of inactivity. Using Starter in production can cause service interruptions. Also, the region is fixed to us-east-1, so latency is high in Asia.
Don't create a separate index for each customer; use namespaces instead. Separating data by namespace within a single index is cost-efficient and easy to manage. When searching, specifying the namespace also ensures that only the relevant data is queried.