Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

hnsw.ef_search controls how many candidates pgvector considers during HNSW search. A low candidate budget can make a relevant chunk less likely to appear, but HNSW is approximate even at higher settings. Compare its results with exact nearest-neighbor search, then raise the budget gradually while tracking recall and latency.

Why an HNSW search can miss the nearest chunk

HNSW (Hierarchical Navigable Small World) organizes vectors into layered proximity graphs. Search starts in an upper layer and moves through the graph toward likely neighbors, rather than scoring every stored vector. This makes retrieval efficient, but approximate: the returned top-k results can differ from the true nearest neighbors. A mismatch alone does not mean the stored data or embedding is corrupted. The original HNSW paper describes the graph structure; Elasticsearch’s kNN API documentation likewise notes that HNSW may not return the true nearest neighbors.

What hnsw.ef_search changes in pgvector

In pgvector, hnsw.ef_search sets the query-time candidate-list size. The current pgvector documentation gives a default of 40 and a range of 1 to 1000. These are pgvector-specific documented values, not universal HNSW defaults. Raising the value generally improves recall because search considers a larger candidate list, at the cost of additional query work and latency.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Because an HNSW index scan returns at most about ef_search rows, pgvector advises setting it to at least the query’s LIMIT. For example, when requesting 20 results, test a value of 20 or higher; this is a floor for the candidate budget, not a guarantee that the correct 20 neighbors will be returned.

#1 Best Overall
Sale
BONTEC Mobile Standing Desk with Keyboard Tray, Mobile Podium on Wheels
  • ADJUSTABLE HEIGHT DESIGN: The mobile standing desk promotes a healthier workstyle by allowing quick transitions between sitting and standing. The gas spring lift smoothly adjusts the height from 28.3in to 44in, supporting better posture and reducing neck and back strain during long working hours. This portable desk improves daily comfort and productivity across different environments.
  • SUPERIOR STABILITY AND DURABILITY: The rolling desk adjustable height model stands out with its sturdy H shaped steel base and reinforced structure, providing stability even at maximum extension. The waterproof and scratch resistant MDF desktop ensures long lasting use, while the retractable keyboard tray and hook create organized storage for accessories. This unique design differentiates the desk from standard folding table or rolling podium options on the market.
  • ERGONOMIC AND FUNCTIONAL DESIGN: The portable standing desk offers a spacious 25.6 x 17.7in surface to accommodate a laptop, monitor, or books. A dedicated slot holds phones and tablets, while the 23.6 x 11.8in keyboard tray supports a full size keyboard and mouse. The thoughtful structure allows the small standing desk to serve as a side table, study cart, or computer desk with keyboard tray in living rooms, bedrooms, and offices.
  • EASY MOBILITY WITH LOCKABLE WHEELS: The adjustable rolling desk includes four caster wheels that allow smooth movement between rooms. The lockable function secures the desk in place when needed, creating flexibility for use as a rolling laptop desk, classroom furniture, or teacher standing desk. The compact rolling table design makes the desk on wheels easy to move, while maintaining stability during presentations or study sessions.
  • EASY OPERATION AND LOW MAINTENANCE: The sit stand desk is operated with a simple hand lever that activates the gas spring for smooth upward adjustment, while gentle pressure lowers the surface. The mobile desk workstation requires minimal maintenance, as the MDF board is waterproof, scratch resistant, and easy to clean with a damp cloth. This reliable raising desk minimizes user effort and ensures long term durability without complex upkeep.

To test a value for one transaction without changing the setting for other sessions, pgvector documents SET LOCAL:

BEGIN;
SET LOCAL hnsw.ef_search = 100;
SELECT id, content
FROM chunks
ORDER BY embedding <-> '[...]'
LIMIT 20;
COMMIT;

Replace the illustrative vector with the query vector and use the distance operator appropriate to the index and metric. This example changes the search budget only within the transaction.

Rank #2
HUANUO 32x19 Inch Small Electric Standing Desk, Adjustable, Light Walnut
  • 【32” x 19” Perfect for Small Spaces & Corner】 Specially designed with a compact 32" x 19" desktop, this small electric standing desk seamlessly fits into limited areas like apartments, bedrooms, and cozy home office corners without crowding your room. It is the ultimate space-saving, height-adjustable solution to pair with under-desk treadmills and walking pads for remote workers, freelancers, and students
  • 【4 Memory Presets & DIY Wheel Ready】 This adjustable desk features a smart control panel with 4 programmable memory presets for effortless one-touch height adjustment (28.3" to 46.5"). Plus, built-in universal M8 screw holes on the desk feet allow you to easily install your own casters/wheels to DIY it into a mobile rolling desk.
  • 【176 lbs Max Load & Rounded Safety Corners】 Constructed with heavy-duty steel rails and a solid desktop, this small stand up desk supports up to 176 lbs with exceptional stability while transitioning. The tabletop features smooth rounded corners to protect you, your family, or pets from accidental bumps in tight, compact spaces.
  • 【Rigorously Tested for Long-Lasting Use】 Engineered for daily reliability, our motor and lifting system have been rigorously tested to withstand up to 50,000 lift cycles under full capacity. Enjoy a whisper-quiet, smooth sit-to-stand transition that keeps you focused and productive all day.
  • 【Easy Assembly & Budget-Friendly Choice】 Comes with detailed instructions and all hardware included for a hassle-free, quick setup. Get premium electric sit-stand functionality at an unbeatable, budget-friendly price. Risk-free purchase with dedicated customer support ready to help.

Diagnose the retrieval path in order

  1. Confirm the engine, index, and query. Check that the query is using the intended HNSW index, the operator class matches the distance metric, and the query’s filters and LIMIT are understood. Record the deployed engine version because documented defaults and capabilities can change.
  2. Build an exact-search baseline. On a representative test set, compare approximate top-k IDs with exact nearest-neighbor results. In pgvector, exact search scans every row, so use an appropriately sized evaluation workload rather than assuming it has the same cost as the indexed query.
  3. Measure recall at the requested k. For each query, divide the number of IDs shared by the approximate and exact top-k results by k; aggregate over representative queries. Keep the test vectors and filters representative of production. This measures ANN recall, not whether the exact neighbors are useful to a person or a RAG answer.
  4. Increase the query-time budget gradually. Test higher pgvector hnsw.ef_search values, keeping each at least as large as the requested result limit. Record recall and query latency together so a quality improvement is weighed against its cost.
  5. If recall remains below target, inspect index construction. In pgvector, m and ef_construction are build-time parameters; the documentation lists defaults of 16 and 64, respectively. A higher ef_construction may improve recall but increases index-build and insertion work. In Qdrant, m and ef_construct can also constrain recall, and changing construction settings may require rebuilding the index. Verify settings for the deployed release before changing them.
  6. Separate retrieval relevance from ANN recall. If approximate search matches exact search but both return poor chunks, the candidate budget is not the cause. Investigate the query formulation, embedding model, chunking, distance metric, filters, or broader retrieval design.

Equivalent controls are engine-specific

Other vector-search systems expose related controls under different names and semantics. Do not transfer pgvector values directly to another engine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Engine Query-time control What to keep in mind
pgvector hnsw.ef_search Documented default 40 and range 1–1000 in current documentation; set at least as high as the query limit. Source
Qdrant hnsw_ef Use Qdrant’s guidance for comparing ANN recall with exact search and tuning the search budget. Source
Weaviate ef Weaviate documents static and dynamic search-budget options. Its guidance says recall improvements diminish above 512 in its implementation; this is not a general HNSW threshold. Source
Elasticsearch num_candidates Candidate search and tuning behavior are specific to Elasticsearch, including its per-segment search. Source
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Choose a setting with quality and cost in view

There is no single value that is best for every index or query. Test against a fixed set of representative queries and compare:

Rank #3
Dell Optiplex 3060 Desktop Computer | Intel i5-8500 (3.2) | 32GB DDR4 RAM | 1TB SSD Solid State | Built in WiFi | Bluetooth | Windows 11 Professional | Home or Office PC (Renewed)
  • [INTEL POWERED CONTENT] - Built with a 8th Generation Hexa-Core Intel i5 and 32GB of DDR4 RAM; Modern, Windows 11 ready, with 4K support, Executive multitasking, media streaming and smooth, multi-tab web browsing; Perfect as an all-purpose multimedia computer; built for content creators; Plenty of RAM and Mass storage for photo and video editing powered by Intel HD 630
  • [LATEST WIRELESS TECH] - This Dell Desktop Computer easily connects to the internet through the Built In WiFi / Bluetooth
  • [SOLID STATE STORAGE] - This Dell Computer setup comes with an ultra-fast 1TB Solid State Drive (SSD); Setup as the primary boot device; Boot and load programs with lightning speed ; Additional expansion available
  • [BUY & OWN WITH CONFIDENCE] - From the world's largest Microsoft Authorized Refurbisher; Quality Guarantee and Free Tech Support; Award-winning Customer Service; | Support Sustainable Business
  • [MODERN HI-SPEED PORTS] - USB 3.0 (x4) | USB 2.0 (x4) | DisplayPort (x1) | HDMI Port (x1) | Audio Combo Jack (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)
  • Recall@k: how much the approximate top-k overlaps the exact top-k.
  • Latency: query time at the same workload and result count.
  • Result count and filters: whether the budget is sufficient for the requested limit and the actual filtered search space.
  • Index costs: build time and insertion overhead if you are changing construction parameters.
  • Operational behavior: whether the engine supports a per-query or dynamic search budget and whether a construction change requires a rebuild.

Exact-neighbor overlap is a useful diagnostic, not a complete retrieval-quality score. A chunk can be a true nearest neighbor and still be irrelevant to the user’s question; evaluate relevance and end-to-end answer quality separately. Qdrant’s recall tutorial distinguishes ANN recall from broader retrieval quality.

Rank #4
Sale
VIVO Black 32 in Standing Desk Converter, DESK-V000K
  • Create Instant Active Standing - VIVO’s desk riser provides on-demand standing throughout the day for the freedom to get out of your chair and relieve muscle tension, reduce stress, and increase productivity. --Patented--
  • Space Efficient 31.5" Surface - The top surface measures 31.5” x 15.7”, which maximizes space while still providing room for dual monitors. The 31.3" x 11.8" (10.5" in center) keyboard tray raises in sync with the top surface to create a comfortable workstation.
  • Strong 33 lbs Lift Assist - Go from sitting to standing in one smooth motion using the innovative simple touch height locking mechanism (Adjustment Range: 4.5" to 20"). Lift design elevates straight upwards.
  • Very Minimal Assembly - This riser is almost ready to go right out of the box! Place on your existing desk, attach the keyboard tray, and start organizing your workstation.
  • We've Got You Covered - Sturdy, high-grade steel design is backed with a 3-Year Manufacturer Warranty and friendly tech support to help with any questions or concerns.

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.