For most semantic-search workloads, start with cosine distance in pgvector (<=>) and use a cosine operator-class index. If your embedding model guarantees unit-normalized vectors, inner product (<#>) is also a sound choice and pgvector recommends it for performance. The metric is only one part of the decision: establish exact-search quality first, then tune an approximate index against that baseline using representative queries and production filters.
Choose a distance metric that matches the embeddings
pgvector orders nearest-neighbor results by ascending distance. Its principal vector operators are:
As an Amazon Associate I earn from qualifying purchases.
| Metric | pgvector operator | Meaning and use |
|---|---|---|
| Cosine distance | <=> |
Ranks by angular difference; a practical default for semantic-search embeddings. |
| Negative inner product | <#> |
Ranks by inner product. It is negative because PostgreSQL index scans use ascending operator order. |
| Euclidean (L2) distance | <-> |
Measures straight-line distance between vectors. |
| Manhattan (L1) distance | <+> |
Measures the sum of coordinate-wise absolute differences. |
| Hamming distance | <~> |
Counts differing bits for binary vectors. |
| Jaccard distance | <%> |
Measures dissimilarity for binary vectors. |
For OpenAI embeddings, the official guidance recommends cosine similarity and says the distance-function choice typically does not matter much. OpenAI also documents that its embeddings are normalized to length 1, so cosine similarity and Euclidean distance give identical rankings, and cosine similarity can be computed as a dot product. pgvector likewise recommends inner product for best performance with normalized vectors. These equivalences are specific to normalized vectors; check the documentation for the exact model you use rather than assuming it normalizes output. OpenAI’s embeddings guide and the pgvector README describe these behaviors.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Distance and similarity are not interchangeable labels in query output. To report cosine similarity, calculate 1 - (embedding <=> query). To report inner product, negate the result of <#>.
#1 Best Overall
- EVOLUTION AMD RYZEN AI MAX+ 395 MINI PC - GMKtec EVO-X2 is the next evolution in AI mini PC Ryzen Strix Halo series. Thanks to AMD Simultaneous Multithreading (SMT) the core-count is effectively doubled, to 32 threads. Ryzen AI Max+ 395 has 64 MB of L3 cache and can boost up to 5.1 GHz, depending on the workload. The Ryzen AI Max+ 395 is currently rated as the "most powerful x86 APU" on the market for AI computing.
- AI NPU with XDNA 2 ARCHITECTURE - Powered by 16 “Zen 5” CPU cores, 50+ peak AI TOPS XDNA 2 NPU and a truly massive integrated GPU driven by 40 AMD RDNA 3.5 CUs, the Ryzen AI MAX+ 395 is a transformative upgrade and delivers a significant performance boost over the competition. The Ryzen AI Max+ 395 excels in consumer AI workloads like the llama.cpp-powered application: LM Studio. Shaping up to be the must-have app for client LLM workloads, LM Studio allows users to locally run the latest language model without any technical knowledge required and unleash their creativity and productivity.
- AMD RADEON 8090S iGPU GAMING PC - The AMD Radeon RX 8060S offers all 40 CUs with up to 2.9 GHz graphics clock and uses the new RDNA 3.5 architecture. The powerful iGPU is positioned between an RTX 4060 and 4070 laptop GPU and therefore enables gaming in FHD at maximum details in most demanding games. The 8060S can also utilize the full 128GB pool, which is perfect for running LLMs such as Deepseek 70B Q8, which runs comfortably on this machine.
- EIGHT CHANNEL LPDDR5X - LPDDR5X is a new ground breaking memory small form factor installed on-board. With blazing speeds up to to 8000MT/s, it runs 1.5x faster than the DDR5 SODIMMs; 90% better performance over DDR5 SODIMMs in video conferencing and photo editing; 30% better performance in productivity apps; 12% better performance in digital content workloads.
- QUAD SCREEN 8K DISPLAY SUPPORT - EVO-X2 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and dual USB 4 40Gbps Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.
Match the query operator to the index
The operator in the nearest-neighbor query must correspond to the index operator class. A mismatch can prevent the intended index from serving the query. For a column named embedding, the matching pairs are:
| Query expression | Index operator class |
|---|---|
embedding <=> query |
vector_cosine_ops |
embedding <#> query |
vector_ip_ops |
embedding <-> query |
vector_l2_ops |
For example, create a cosine HNSW index with:
CREATE INDEX ON items USING hnsw (embedding vector_cosine_ops);
Then query with the same metric:
SELECT id, embedding <=> $1 AS distance
FROM items
ORDER BY embedding <=> $1
LIMIT 10;
Replace $1 with the query vector supplied by your application. pgvector documents corresponding operator classes for HNSW and IVFFlat; confirm the available operators and configuration against the extension version deployed in your database.
Use exact search as the quality baseline
pgvector performs exact nearest-neighbor search by default, which provides perfect recall. An approximate index is a speed-versus-recall trade-off: it can return a different neighbor set from exact search. Therefore, a change that lowers latency is not necessarily an improvement if relevant results disappear.
Recommended Free Tools
Rank #2
- Built for Local AI Development: AMD Ryzen AI Halo is designed for local AI development and inference, featuring 128GB unified memory and support for up to 200B parameter models to build and run intensive AI workloads locally.
- 128GB Unified Memory: Features 128GB LPDDR5x unified memory at 8000 MT/s with 256 GB/s memory bandwidth, providing a shared memory pool across the CPU, GPU, and NPU to support larger AI models.
- AMD Ryzen AI Max+ 395 Processor: Features 16 cores, 32 threads, and Zen 5 architecture, paired with AMD Radeon 8060S integrated graphics featuring 40 RDNA 3.5 compute units and an AMD XDNA 2 NPU with up to 50 TOPS.
- Linux AI Developer Platform: Purpose-built for Linux-based AI development with full AMD ROCm software support and preloaded tools, models, and workflows optimized for local AI development.
- Compact, Connected Design: Includes a 2TB M.2 SSD, 10GbE LAN, Wi-Fi 7, Bluetooth 5.4, USB-C connectivity, and HDMI 2.1b.
Before adding or tuning an approximate index, run the intended query against representative evaluation queries and record a task-appropriate relevance measure, result count, latency, and resource use. Use the same stored vectors, query vectors, filters, and result limit when comparing runs. This separates two questions: whether the metric ranks useful results for your task, and whether the index approximates that ranking acceptably.
Choose between HNSW and IVFFlat
Both index types trade some recall for faster search. pgvector describes HNSW as having a better speed/recall trade-off than IVFFlat, at the cost of slower index builds and higher memory use. IVFFlat builds faster and uses less memory, but has a weaker speed/recall trade-off.
| Consideration | HNSW | IVFFlat |
|---|---|---|
| Structure | Multilayer graph | Partitions vectors into lists and searches a subset of nearby lists |
| Build and memory trade-off | Slower build; higher memory use | Faster build; lower memory use |
| Data needed to build | Can be built before table data exists; no training step | Build after the table contains data, following pgvector’s guidance |
| Main query tuning control | hnsw.ef_search |
ivfflat.probes |
These are qualitative trade-offs documented by pgvector, not a guarantee that one index wins for every database. Compare them with your own data volume, update patterns, resource limits, and filtered-query shape.
Rank #3
- EVOLUTION RYZEN AI MAX+ 395 MINI PC - GMKtec EVO-X2 is the next evolution in AI mini PC Ryzen Strix Halo series. Thanks to AMD Simultaneous Multithreading (SMT) the core-count is effectively doubled, to 32 threads. Ryzen AI Max+ 395 has 64 MB of L3 cache and can boost up to 5.1 GHz, depending on the workload. The Ryzen AI Max+ 395 is currently rated as the "most powerful x86 APU" on the market for AI computing.
- AI NPU with XDNA 2 ARCHITECTURE - Powered by 16 “Zen 5” CPU cores, 50+ peak AI TOPS XDNA 2 NPU and a truly massive integrated GPU driven by 40 AMD RDNA 3.5 CUs, the Ryzen AI MAX+ 395 is a transformative upgrade and delivers a significant performance boost over the competition. The Ryzen AI Max+ 395 excels in consumer AI workloads like the llama.cpp-powered application: LM Studio. Shaping up to be the must-have app for client LLM workloads, LM Studio allows users to locally run the latest language model without any technical knowledge required and unleash their creativity and productivity.
- AMD RADEON 8090S iGPU GAMING PC - The AMD Radeon RX 8060S offers all 40 CUs with up to 2.9 GHz graphics clock and uses the new RDNA 3.5 architecture. The powerful iGPU is positioned between an RTX 4060 and 4070 laptop GPU and therefore enables gaming in FHD at maximum details in most demanding games. The 8060S can also utilize the full 128GB pool, which is perfect for running LLMs such as Deepseek 70B Q8, which runs comfortably on this machine.
- EIGHT CHANNEL LPDDR5X - LPDDR5X is a new ground breaking memory small form factor installed on-board. With blazing speeds up to to 8000MT/s, it runs 1.5x faster than the DDR5 SODIMMs; 90% better performance over DDR5 SODIMMs in video conferencing and photo editing; 30% better performance in productivity apps; 12% better performance in digital content workloads.
- QUAD SCREEN 8K DISPLAY SUPPORT - EVO-X2 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and dual USB 4 40Gbps Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.
Tune the index against your workload
For HNSW
Increasing hnsw.ef_search generally improves recall at a query-speed cost. The construction parameter ef_construction affects recall as well as index build time and insert speed. Tune these settings with the same representative query set used for the exact baseline; do not treat a higher setting as automatically better if its latency cost is unacceptable.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11For IVFFlat
Increasing ivfflat.probes searches more lists and improves recall at a speed cost. pgvector offers starting heuristics for the number of lists: rows divided by 1,000 up to one million rows, and the square root of the row count above one million. It suggests starting probes around the square root of the number of lists. These are configuration heuristics, not universal optimums; measure both quality and latency on your own workload.
Recheck after data or query changes
Recall and latency depend on more than the operator: index settings, data distribution, query volume, and filtering all affect results. Re-evaluate after material changes to embeddings, filters, data size, or index parameters. The pgvector README includes an exact-comparison approach that disables index scans within a transaction so approximate results can be checked against exact results: pgvector project documentation.
Rank #4
Account for filters in approximate search
With approximate indexes, filtering is applied after the index scan. A query can therefore return fewer rows than its requested limit when many candidates fail the filter. Test the actual production query, not just an unfiltered nearest-neighbor query.
pgvector documents several approaches to consider, depending on filter cardinality:
- Iterative scans: allow the scan to continue looking for candidates when filtering leaves too few results.
- Partial indexes: consider them when a filter has only a few distinct values.
- Partitioning: consider it when a filter has many distinct values.
These methods address different data and filter patterns; choose by measuring the query shape and result completeness you need.
A practical decision and validation sequence
- Confirm the model and vectors. Verify the embedding model, dimensions, and normalization behavior. Keep stored and query vectors compatible.
- Pick a metric to test. Start with cosine for semantic-search embeddings unless the model documentation or evaluation supports another choice. For known unit-normalized vectors, compare inner product as well.
- Measure exact results. Run representative queries without an approximate index and capture relevance, result count, latency, and resource use.
- Create a matching index. Choose HNSW or IVFFlat and use the operator class that matches the query operator.
- Tune recall against latency. Adjust HNSW search settings or IVFFlat probes, then compare approximate results to the exact baseline.
- Test filters and monitor. Validate the production query shape, including filters, and periodically compare approximate output with exact results.
The pgvector project README documents the operators, index classes, index trade-offs, tuning controls, and filtered-query behavior: https://github.com/pgvector/pgvector. OpenAI’s model-specific normalization and metric guidance is in its embeddings documentation. Both sources were accessed October 4, 2026; verify details against your deployed pgvector version and chosen embedding model.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




