Qdrant
Qdrant Vector Database
A Rust-based vector search engine. Strong at combining filtering and search.
Qdrant Vector Database
A Rust-based vector search engine. Strong at combining filtering and search.
Qdrant (pronounced "quadrant") is a high-performance open-source vector database developed in Rust. It started in 2021 at a startup in Berlin, Germany, and was designed to take advantage of Rust's strengths in pursuing memory safety and performance at the same time. Its "Filtered Vector Search" feature is particularly powerful, with almost no performance degradation when performing vector similarity search and metadata filtering at the same time.
Qdrant's architecture uses segment-based storage. Data is split and stored across multiple segments, and each segment independently has its own HNSW (Hierarchical Navigable Small World) index. Thanks to this structure, the impact of data insertion on search performance is minimized, and horizontal scaling through sharding and replication is easy. It supports both gRPC and REST APIs, so it can be flexibly integrated in a variety of environments.
The filtering feature is Qdrant's key differentiator. Complex filters can be built by combining "should", "must", and "must_not" conditions, and range queries, geo-coordinate filters, and nested filters are also supported. For example, a composite query is possible that finds similar documents among those "written within the last 30 days, with the category 'Technology', and written by a specific user." Designed to meet such practical requirements, it is one of the most frequently chosen vector DBs for RAG systems, along with Pinecone and Weaviate.
Its variety of deployment options is also an advantage. It can be easily self-hosted as a Docker container, and Kubernetes Helm charts are also provided. Qdrant Cloud is a fully managed service, and up to 1GB can be used on the free tier. Through the hybrid cloud option, you can also run Qdrant on your own infrastructure while enjoying the convenience of the cloud management console. It supports native integration with major LLM frameworks such as LangChain, LlamaIndex, and Haystack.
Here is an example of building a RAG pipeline using the Qdrant Python client:
from qdrant_client import QdrantClient
from qdrant_client.models import (
Distance, VectorParams, PointStruct,
Filter, FieldCondition, MatchValue, Range
)
import openai
from datetime import datetime, timedelta
# 1. Qdrant 클라이언트 초기화
# 로컬: client = QdrantClient(path="./qdrant_data")
# Docker: client = QdrantClient(host="localhost", port=6333)
client = QdrantClient(
url="https://your-cluster.qdrant.io",
api_key="your-api-key"
)
# 2. 컬렉션 생성 (벡터 저장소)
collection_name = "documents"
client.recreate_collection(
collection_name=collection_name,
vectors_config=VectorParams(
size=1536, # OpenAI ada-002 차원
distance=Distance.COSINE # 유사도 측정 방식
)
)
# 3. 문서와 메타데이터를 함께 저장
def embed_text(text):
"""OpenAI 임베딩 생성"""
response = openai.embeddings.create(
model="text-embedding-3-small",
input=text
)
return response.data[0].embedding
documents = [
{"id": 1, "text": "PyTorch는 동적 계산 그래프를 지원하는 딥러닝 프레임워크입니다.",
"category": "ML", "author": "kim", "created_at": "2024-01-15"},
{"id": 2, "text": "Qdrant는 Rust로 개발된 고성능 벡터 데이터베이스입니다.",
"category": "Database", "author": "lee", "created_at": "2024-01-20"},
{"id": 3, "text": "RAG는 검색과 생성을 결합한 AI 기술입니다.",
"category": "ML", "author": "kim", "created_at": "2024-01-25"},
]
# 벡터와 메타데이터를 함께 업로드
points = [
PointStruct(
id=doc["id"],
vector=embed_text(doc["text"]),
payload={ # 메타데이터
"text": doc["text"],
"category": doc["category"],
"author": doc["author"],
"created_at": doc["created_at"]
}
)
for doc in documents
]
client.upsert(collection_name=collection_name, points=points)
print(f"Uploaded {len(points)} documents")
# 4. 필터링 + 벡터 검색 (Qdrant의 강점!)
query = "딥러닝 프레임워크에 대해 알려줘"
query_vector = embed_text(query)
# 복합 필터: category가 'ML'이고, 2024-01-01 이후 작성된 문서
results = client.search(
collection_name=collection_name,
query_vector=query_vector,
query_filter=Filter(
must=[
FieldCondition(key="category", match=MatchValue(value="ML")),
]
),
limit=5,
with_payload=True
)
print("\n=== 검색 결과 ===")
for result in results:
print(f"Score: {result.score:.4f}")
print(f"Text: {result.payload['text']}")
print(f"Author: {result.payload['author']}")
print("---")
# 5. 다양한 필터 조합 예시
# must_not: 특정 저자 제외
# should: 여러 조건 중 하나 이상 매칭
complex_filter = Filter(
must=[
FieldCondition(key="category", match=MatchValue(value="ML"))
],
must_not=[
FieldCondition(key="author", match=MatchValue(value="park"))
]
)
# 6. 배치 검색 (여러 쿼리 동시 처리)
from qdrant_client.models import SearchRequest
batch_results = client.search_batch(
collection_name=collection_name,
requests=[
SearchRequest(vector=embed_text("벡터 DB"), limit=3),
SearchRequest(vector=embed_text("딥러닝"), limit=3),
]
)
| Plan | Price | Storage | Features |
|---|---|---|---|
| Free (Cloud) | Free | 1GB | Prototypes, personal projects |
| Starter (Cloud) | From $25/month | 10GB~ | Small-scale production |
| Business (Cloud) | From $100/month | 50GB~ | HA, dedicated resources |
| Self-Hosted | Free (infrastructure costs) | Unlimited | Full control, customization |
| Hybrid Cloud | $0.014/hr~ | Own infrastructure | Managed + data locality |
Performance benchmark: Search latency of ~5ms based on 1M vectors (~10ms with filters). Self-hosting costs can be reduced by 70% compared to Pinecone. Being Rust-based, it has excellent memory efficiency, allowing more vectors to be stored on the same specs.
"I recommend Qdrant as the vector DB for the RAG system. Its filtering performance is excellent, so there is almost no increase in latency even for composite-condition searches like 'only Team A documents from the last week.' Self-hosting takes just a single line of Docker."
"The reasons I chose Qdrant are its Rust-based memory safety and performance, and the excellence of its filtered vector search. Pinecone is convenient because it is fully managed, but it is costly, whereas with Qdrant's self-hosting we were able to cut costs by 70% while achieving equivalent performance."
"Qdrant's segment architecture is advantageous for write performance. New data is written to a separate segment first, so search can continue without affecting the existing index, and it is merged in the background. However, if there are too many segments, search speed can slow down, so optimizer settings are important."
Take a mock interview on this topic → WIA SOOM AI Interview · Start for free