tencent cloud

TencentDB for PostgreSQL

文档TencentDB for PostgreSQLAI CapabilitiesVector and Graph SearchTencentDB for PostgreSQL pgvector HNSW Performance Test Report

TencentDB for PostgreSQL pgvector HNSW Performance Test Report

Download
聚焦模式
字号
最后更新时间: 2026-08-27 16:39:32
本文档由 AI 翻译

Testing Environment

Configuration Item
Description
Database
RDS PostgreSQL 17
pgvector
0.8.0
Instance Specifications
16 vCPU / 64 GB
Client
4 vCPU / 8 GB (Same VPC)
Test Tool
Stress Test Mode
Single-threaded
Recall Metric
Recall@100

Test data set

Dataset
Level
Vector Count
Distance Type
Typical Scenario
dbpedia-openai-1M
1536
1,000,000
Cosine
OpenAI / Large Model Embedding
NYTimes-256
256
290,000
Cosine
Text similarity search

Testing Method

Preparing the Environment

1. Install ann-benchmarks.
git clone https://github.com/erikbern/ann-benchmarks.git
cd ann-benchmarks
pip install -r requirements.txt
2. Configure the database connection.
Edit ann_benchmarks/algorithms/pgvector/module.py and add the connection information:
import os
os.environ['ANN_BENCHMARKS_PG_USER'] = '<username>'
os.environ['ANN_BENCHMARKS_PG_PASSWORD'] = '<password>'
os.environ['ANN_BENCHMARKS_PG_DBNAME'] = '<database name>'
os.environ['ANN_BENCHMARKS_PG_HOST'] = '<instance private network address>'
os.environ['ANN_BENCHMARKS_PG_PORT'] = '5432'
os.environ['ANN_BENCHMARKS_PG_START_SERVICE'] = 'false'
3. Configure test parameters
Edit ann_benchmarks/algorithms/pgvector/config.yml:
float:
any:
- base_args: ['@metric']
constructor: PGVector
disabled: false
docker_tag: ann-benchmarks-pgvector
module: ann_benchmarks.algorithms.pgvector
name: pgvector
run_groups:
M-16(200):
arg_groups: [{M: 16, efConstruction: 200}]
args: {}
query_args: [[10, 20, 40, 80, 120, 200, 400, 800]]
M-24(200):
arg_groups: [{M: 24, efConstruction: 200}]
args: {}
query_args: [[10, 20, 40, 80, 120, 200, 400, 800]]
M-48(256):
arg_groups: [{M: 48, efConstruction: 256}]
args: {}
query_args: [[10, 20, 40, 80, 120, 200, 400, 800]]
4. Build the test Docker image.
python install.py --algorithm pgvector

Executing a Test

# Testing with the dbpedia-openai-1M dataset
python run.py --dataset dbpedia-openai-1000k-angular -k 100 --algorithm pgvector --runs 1

# Testing with the NYTimes-256 dataset
python run.py --dataset nytimes-256-angular -k 100 --algorithm pgvector --runs 1

Result obtaining

# Generate visualization charts
python plot.py --dataset dbpedia-openai-1000k-angular --recompute

# Export detailed CSV data
python data_export.py --out results.csv

Performance Test Results

dbpedia-openai-1M (1536 Dimensions / 1 Million Vectors)

Scenario
Index Configurations
ef_search
Recall@100
QPS
P99(ms)
High recall
m=24, ef_construction=200
120
99.2%
225
7.2
Ultra-high recall
m=48, ef_construction=256
120
99.8%
146
12.3

NYTimes-256 (256 Dimensions / 290,000 Vectors)

Scenario
Index Configurations
ef_search
Recall@100
QPS
P99(ms)
High recall
m=24, ef_construction=200
400
89.0%
101
12.7
Ultra-high recall
m=24, ef_construction=200
800
93.9%
52
23.6

帮助和支持

本页内容是否解决了您的问题?

填写满意度调查问卷,共创更好文档体验。

文档反馈