Questions
13 of 14
1What is a segment in Qdrant's storage engine, and why does a collection consist of multiple segments rather than one monolithic index?
2What role does the Write-Ahead Log (WAL) play in Qdrant, and what failure scenario does it protect against?
3How does memory-mapped (mmap) storage allow Qdrant to serve a collection larger than available RAM?
4What does the background optimizer do in Qdrant, and why can too-aggressive optimization affect query latency?
5What is the practical difference between storing vectors in-memory versus on-disk in a collection configuration, and when would you choose on-disk?
6What is sharding in a distributed Qdrant cluster, and what determines which shard a given point is written to by default?
7What is custom sharding, and how does it change the way multitenant data is distributed across a cluster?
8What consensus algorithm does Qdrant use to keep cluster metadata consistent across nodes, and what does it coordinate?
9What are Qdrant's tunable read/write consistency levels for distributed operations, and what trade-off do they represent?
10In a replicated cluster, what happens to search results if a query is served while one replica of a shard is temporarily out of sync?
11Walk through what happens internally, at a high level, when a client sends a filtered vector search request to a distributed Qdrant cluster.
12Why does Qdrant merge and re-rank results from multiple shards rather than simply concatenating each shard's top-k?
13How does a payload filter interact with segment selection during query execution - does Qdrant always scan every segment?
14What is the performance implication of running a query that touches every named vector on a point versus one that specifies using?
13 / 14

How does a payload filter interact with segment selection during query execution - does Qdrant always scan every segment?

Payload indexes and segment statistics let the planner prune segments

Qdrant does not always scan every segment. A payload filter is planned against the payload indexes and segment-level statistics to determine which segments can possibly contain matching points, and segments that cannot are skipped entirely. The simplest form of pruning is a segment that contains no points at all for the filtered value - for example, if a segment has a payload index on tenant_id and the filter is tenant_id = "tenant_a", a segment whose index shows no tenant_a points is skipped. More sophisticated pruning uses range statistics: if a filter is created_at >= "2024-01-01" and a segment's index records a maximum created_at before that date, the segment can be skipped. This pruning happens before any vector search, so it reduces the number of HNSW traversals the query has to perform, which is a direct saving on both latency and CPU.

The mechanism depends on the type of payload index. A keyword index maps values to posting lists of point IDs; a filter on a keyword can be resolved to a set of matching points, and segments whose posting lists are empty for the filtered value are skipped. An integer or datetime index supports range queries and can be pruned using min/max statistics at the segment level. A full-text index supports term-based pruning. Without an index, the filter has to be evaluated by reading each point's payload, which means no segment-level pruning is possible and every segment in the shard has to be traversed with the filter checked per candidate - this is the expensive case. Even with an index, the planner has to choose between using the index to build a candidate bitmap and using it only to prune segments; for very selective filters the index-first approach wins, while for less selective filters the filter-aware HNSW traversal may be cheaper. This is a cost-based decision and the planner's behavior has evolved across versions.

  1. 1

    Keyword index: posting lists per value; segments with no matching value are pruned.

  2. 2

    Integer / datetime index: range queries; segments whose min/max range does not overlap are pruned.

  3. 3

    Full-text index: term-based pruning at the segment level.

  4. 4

    No index: every segment is visited and the filter is checked per candidate; no pruning possible.

  5. 5

    Planner choice: index-first candidate retrieval versus filter-aware HNSW traversal, decided by estimated cost.

The trade-off is index maintenance and memory against query pruning. Payload indexes cost memory and slow down ingest slightly because each upsert has to update the index, but they enable segment pruning and filter-aware traversal, which can be a large latency win for selective filters. The common mistake is not creating a payload index on a field that is filtered frequently, which forces the engine to check every candidate's payload and prevents segment pruning. The second mistake is creating an index on a field with very low cardinality (e.g. a boolean) and expecting a large speedup - the index helps, but the pruning benefit is limited because most segments will contain both values. The third mistake is assuming that a filter always reduces the search cost. A filter that matches almost everything does not reduce the number of candidates the traversal has to consider, and can add overhead because the filter check runs per candidate. Version note: the set of supported payload index types and the planner's pruning logic have changed across releases; the exact behavior under a combined filter (multiple conditions with must/should/must_not) is version-specific and worth benchmarking on your own data.

javascript

Version-dependent: payload index types, the query planner's pruning behavior, and the ability to combine index-based and scan-based execution have evolved across Qdrant releases. The introduction of the prefetch/fusion API also changed how filters interact with multi-stage queries - in a prefetch, the filter is applied at the stage where it is specified, and the planner's behavior at each stage is version-specific. If you are tuning filtered search performance, create the indexes you expect to need, benchmark with your actual filter selectivity, and verify the planner's behavior on your version rather than assuming a particular pruning strategy.

Difficulty: 8/10
Topics: Query Execution, Filtering, Segments

Scenario Questions

0-2 years experience
  1. 1

    You filter on a payload field that has no index and the query is slow. Explain what the engine has to do and what you would add to fix it.

  2. 2

    A teammate says a filter always makes a query faster because it reduces the candidate set. Explain when that is not true.

2-5 years experience
  1. 1

    You create a payload index on a low-cardinality field and the query barely gets faster. Explain why and whether a different index or query shape would help.

  2. 2

    Your filtered query is fast on one shard and slow on another, even though the filter is the same. Diagnose how segment composition and index coverage could cause this.

5-8 years experience
  1. 1

    Design a payload index strategy for a collection with 20 filterable fields, only some of which are used in hot queries. How do you decide which fields to index and what index type to use?

  2. 2

    You have a query with a combined filter (must + should + must_not). Explain how the planner handles it and how you would tune the indexes to make it fast.

8+ years experience
  1. 1

    Derive the expected cost of a filtered query as a function of filter selectivity, index availability, segment count, and segment-level statistics. Where does the model predict that indexing stops helping?

  2. 2

    You are designing a query planner that chooses between index-first retrieval, filter-aware HNSW, and full scan. Describe the cost model, the statistics you would collect per segment, and how you would validate the planner against production traffic.

Follow-up Questions

  • How would you determine whether a slow filtered query is caused by the absence of a payload index, by a filter that is too selective for the traversal, or by a planner choice that is suboptimal for your data?
  • What index type would you choose for a field with a heavy-tailed value distribution, and how would that change the pruning behavior?