Supabase Blog

pgvector vs Pinecone: cost and performance

thumbnail

Here's a summary of the comparison between pgvector and Pinecone in terms of cost and performance:

  1. Index Types: Pinecone offers three types of pods for indexes: s1, p1, and p2. Each type has different capacities for vectors, query processing speed, and accuracy.

  2. Cost: The price per unit per month for Pinecone's pods varies based on the type. The s1 pod costs $80, the p1 pod costs $80, and the p2 pod costs $120.

  3. Scaling: Pinecone allows scaling in two dimensions: vertically and horizontally. Vertical scaling increases the number of vectors that can fit in a single pod, while horizontal scaling adds more pods or replicas to boost query per second (QPS) performance.

  4. Performance Comparison: In the benchmarking results, Pinecone's s1 pod type achieved an accuracy@10 score of 0.98 for the dbpedia dataset. To match this accuracy, pgvector (HNSW) queries managed 1185% more QPS and were $70 cheaper per month. Even the pgvector IVFFlat index outperformed the Pinecone s1 pod by managing 143% more QPS.

  5. Additional Comparison: With Pinecone's p1 pod type, a single p1.x2 pod costing $160/month achieved an accuracy@10 of 0.99 for the dbpedia dataset. To match this accuracy, pgvector (HNSW) queries required approximately 12-13 p1.x2 pods. On the other hand, to match Pinecone's speed with pgvector, you would need to sacrifice 5% accuracy.

  6. Considerations: Pinecone may be cheaper than pgvector if a single p1.x2 pod without replicas is sufficient for the workload. However, using pgvector on Supabase might require a larger compute add-on, resulting in a higher cost.

In conclusion, Pinecone and pgvector have different trade-offs between cost, accuracy, and query speed. It is essential to consider the specific requirements and budget constraints when choosing between the two options.