Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Yes—you can use pgvector without model-generated embeddings. A hand-built feature vector can be a better fit when your data is structured and you already know which measurable attributes should make two records similar. For unstructured text or images, embeddings are usually the more natural starting point; for a task defined by only a few numeric conditions, ordinary SQL may be simpler than either.
Do you need embeddings to use pgvector?
No. pgvector is a PostgreSQL extension for storing supported vector types and finding nearby vectors with distance operators. It does not create the vectors or decide what their dimensions mean. An application can compute a vector from structured columns—such as measurements, counts, proportions, or other features—and store and compare it with pgvector.
As an Amazon Associate I earn from qualifying purchases.
That distinction matters: a vector is a representation, not automatically a semantic understanding of the record. With a hand-built feature vector, your choices about dimensions, normalization, weights, and missing values determine what “similar” means. This is a design heuristic, not evidence that hand-built vectors universally outperform embeddings.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →When should you use a feature vector instead of semantic search?
Consider a feature vector when the records are structured, the product’s notion of similarity can be stated clearly, and the important attributes can be measured. For example, a recommendation system for equipment might compare known specifications if those specifications are what users mean by “similar.” If the meaningful features are difficult to enumerate—because they are implicit in prose, images, or other unstructured content—a model embedding is often a more natural candidate.
#1 Best Overall
| Approach | Consider it when | Main trade-off |
|---|---|---|
| Hand-built feature vector | Data is structured and useful similarity dimensions are known and measurable. | You control the named dimensions, but feature selection, scaling, weights, and missing-data handling require application-specific evaluation. |
| Model embedding | Inputs are unstructured, such as prose or images, and useful similarity dimensions are hard to specify manually. | A model supplies a learned representation, which is less directly interpretable than named hand-built dimensions. |
| Both | Structured attributes and unstructured content contribute distinct similarity signals. | You need to decide how to combine the signals; there is no universally established fusion method or guaranteed gain. |
| Ordinary SQL | One or two numeric criteria or straightforward predicates capture the task. | A vector representation and index may add needless complexity when a regular filter and sort express the requirement. |
The useful question is not whether one representation is categorically better. Ask whether the representation matches the inputs and the relevance decision your application needs to make. Evaluate the candidates on that task rather than treating the word “semantic” or “vector” as a quality guarantee.
How to design a useful feature vector
Choose dimensions that express the real similarity question
Start by writing down what should make two records similar, then map that definition to source columns. A baseball-pitcher example in an Agave Information Solutions article published June 13, 2026 uses pitch-type shares, location means and spreads by pitch type, velocity averages and ranges where available, and changes in pitch mix by count. Those dimensions describe pitcher behavior; they are an illustration, not a general recipe for other domains.
Normalize attributes on different scales
If a large-scale measurement is mixed raw with a small-scale one, the large-scale value can dominate a distance calculation. Standardization such as z-scores or a fixed min-max range can put dimensions on more comparable scales. The right transformation depends on the data distribution and the behavior you want; validate it against representative examples rather than assuming one method is correct.
Weight dimensions deliberately
Scaling selected dimensions can express that some characteristics matter more than others. That control is interpretable, but the weights are still a product or domain decision. Explicit weights are not automatically relevant weights: assess whether the resulting nearest neighbors make sense for the application.
Represent missing values intentionally
A missing measurement is not the same as zero. The pitcher example notes that missing velocity readings were common in that author’s data and suggests imputing a population mean or dropping a dimension and renormalizing. Those are possible strategies, not independently validated rules. Choose a policy that preserves the meaning of absence in your data and apply it consistently when constructing query vectors.
What does a pgvector feature-vector query look like?
The following pattern follows the pitcher example: create a 32-dimensional column, add an HNSW index configured for cosine distance, and order candidates by cosine distance from a target vector. The 32 dimensions and request for 10 rows belong to that example; they are not recommended universal settings.
Rank #3
CREATE EXTENSION IF NOT EXISTS vector;
ALTER TABLE pitcher_profiles
ADD COLUMN feature_vec vector(32);
CREATE INDEX ON pitcher_profiles
USING hnsw (feature_vec vector_cosine_ops);
SELECT id, name
FROM pitcher_profiles
WHERE id <> @target_id
ORDER BY feature_vec <=> @target_vec
LIMIT 10;
The application must construct @target_vec using the same feature definitions and transformations used for stored profiles. The query ranks by the chosen distance; it does not infer or repair an unsuitable representation. In this example, the index operator class and ordering operator both use cosine distance.
When is a regular SQL query enough?
If the request is essentially “find records within this numeric range” or “sort by one measured value,” ordinary SQL filtering and sorting may be clearer and easier to maintain. Vector search becomes useful when similarity depends on a combined representation across multiple dimensions and the application needs nearest-neighbor ranking. A vector index is not a requirement just because the underlying values are numeric.
How do exact search and approximate indexes differ?
The pgvector project README says exact nearest-neighbor search is the default and provides perfect recall. Adding HNSW or IVFFlat enables approximate search, which can be faster but may return different results from exact search. The project describes HNSW as offering a better query-performance trade-off than IVFFlat, with slower index builds and greater memory use; IVFFlat builds faster and uses less memory, with lower query performance in that trade-off. These are upstream descriptions, not guarantees for a particular workload.
Rank #4
| Search choice | What to expect | Important consideration |
|---|---|---|
| Exact nearest-neighbor search | Perfect recall, according to the pgvector project README. | Use it as a relevance baseline when assessing approximate results. |
| HNSW | Approximate search using a multilayer graph; project documentation describes stronger query performance in the speed-recall trade-off than IVFFlat. | Index builds are slower and memory use is higher than IVFFlat, according to the project documentation. |
| IVFFlat | Approximate search that partitions vectors into lists and searches selected lists. | It requires training and should be built after the table has data; project documentation describes faster builds and lower memory use, with lower query performance in the trade-off. |
pgvector supports several distance operators: L2 distance (<->), negative inner product (<#>), cosine distance (<=>), L1 distance (<+>), and Hamming or Jaccard distance for binary vectors (<~> and <%>). Match the index operator class to the distance you intend to use. The negative sign in <#> lets PostgreSQL perform an ascending index scan for inner product.
Use IVFFlat settings as starting points, not promises
The project README suggests an initial number of IVFFlat lists of rows divided by 1,000 for tables up to one million rows, and the square root of the row count above one million. It suggests starting with the square root of the list count for probes. These are tuning heuristics, not benchmark results or universal optimal settings. More probes generally improve recall at a speed cost. Compare the chosen setup with exact search and benchmark it using your own data and query patterns.
How do filters affect approximate vector search?
With approximate indexes, filtering is applied after the index scan. The pgvector README illustrates the effect with a filter that matches 10% of rows and HNSW’s default ef_search value of 40: an average of four matching rows is expected from that scan. That illustration shows why a selective filter can leave too few qualifying results even when the unfiltered nearest-neighbor scan returns candidates.
Best Value
The project documents iterative scans, indexes on filter columns, partial indexes for a few distinct values, and partitioning for many distinct values as possible approaches. Which is appropriate depends on filter selectivity, tenant boundaries, and how many results the application needs. Measure filtered results and latency rather than assuming an approximate index will return a fixed number of qualifying rows.
Can feature vectors and embeddings work together?
Yes, if structured attributes and unstructured content each carry a distinct relevance signal. You could retrieve by structured feature similarity and by text or image embeddings, then combine or rerank the candidates. The pgvector documentation discusses combining PostgreSQL full-text search with vector search and names Reciprocal Rank Fusion or a cross-encoder as possible result-combination approaches. These are options, not a universally best strategy; evaluate the combined results against the needs of the application.
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.




