accesspatterns.dev

When similarity is the wrong question

Some questions are not similarity questions, and a vector index answers them badly.

Why

TopK is a hard ceiling of 100, and there is nothing behind it. A search response carries no LastEvaluatedKey, so there is no way to ask for the next hundred. Every other read in this course can be continued; this one cannot.

That changes what post-filtering costs you. Filter a Query's results in your application and you can always go back for more rows. Filter a search's results and you are spending from a fixed budget of a hundred with no way to top it up. This catalogue has 104 in-stock outdoor products and just 12 of them are under 50 pounds, so a hundred results spent on similarity, then filtered on price in your own code, leaves you with a handful and no way to ask for others. The third run answers that same question exactly, with a key condition, and it is not close.

Three shapes where a vector index is the wrong tool. An exact lookup: you know the key, so use it. A small candidate set: a Query reads all of them for less than a search costs. And anything needing full recall, because a production vector index is approximate by design and can miss a match that was genuinely there.

That last point needs care on this page, because the engine running these examples is not approximate. It compares your query against every entry in the scoped index and returns the true nearest, which is why the results here are exactly reproducible. AWS builds an approximate index and trades a little recall for speed at a scale this table will never reach. The mechanics, the API, the refusals and the costs are the same; the guarantee about completeness is not, and it is the one thing on this page you should not carry across unchanged.

None of this makes vector indexes a bad tool, and it does not make them a replacement for a GSI either. They are complements. Reach for the vector index when the question is genuinely "what is like this", and for a key condition when it is "what matches this". Most features need both, and the tell is whether you could write the question down as a rule.

Top-K is a hard ceiling with no pagination behind it, so anything you can express as a key condition belongs in one; a vector index answers "what is like this", not "what matches this".

ProductCatalogue

These rows are real and already here. Running an operation against them downloads a DynamoDB-compatible engine, about 850 KB, and executes it in this tab.

Try an example

TopK at its maximum, filtered to in-stock outdoor gear. A hundred results come back, which is every result you are ever going to get for this query.

pk(pk)
category
name
price
inStock
embedding
PRODUCT#prod-outdoor-001
outdoorS
Ultralight tentS
15N
noS
[0.001, 0.0759, -0.0369, … 384]L
PRODUCT#prod-outdoor-002
outdoorS
Two-person tentS
52N
yesS
[0.0064, 0.0912, -0.0264, … 384]L
PRODUCT#prod-outdoor-003
outdoorS
Winter tentS
89N
yesS
[-0.0416, 0.1198, -0.0327, … 384]L
PRODUCT#prod-outdoor-004
outdoorS
Budget tentS
126N
yesS
[0.013, 0.1391, -0.0587, … 384]L
PRODUCT#prod-outdoor-005
outdoorS
Expedition tentS
163N
yesS
[-0.0042, 0.0797, -0.0276, … 384]L
PRODUCT#prod-outdoor-006
outdoorS
Compact tentS
200N
yesS
[0.0042, 0.1235, -0.0681, … 384]L
PRODUCT#prod-outdoor-007
outdoorS
Insulated tentS
237N
yesS
[0.005, 0.1238, -0.0367, … 384]L
PRODUCT#prod-outdoor-008
outdoorS
Waterproof tentS
274N
yesS
[-0.0335, 0.1163, 0.0145, … 384]L
PRODUCT#prod-outdoor-009
outdoorS
Folding tentS
311N
yesS
[-0.0254, 0.102, -0.04, … 384]L
PRODUCT#prod-outdoor-010
outdoorS
Childrens tentS
48N
yesS
[-0.0036, 0.1021, -0.0362, … 384]L
PRODUCT#prod-outdoor-011
outdoorS
Ultralight sleeping bagS
85N
yesS
[-0.0101, 0.0789, -0.0579, … 384]L
PRODUCT#prod-outdoor-012
outdoorS
Two-person sleeping bagS
122N
yesS
[0.0213, 0.0949, -0.0628, … 384]L
PRODUCT#prod-outdoor-013
outdoorS
Winter sleeping bagS
159N
yesS
[-0.0585, 0.1261, -0.0518, … 384]L
PRODUCT#prod-outdoor-014
outdoorS
Budget sleeping bagS
196N
yesS
[0.0069, 0.1173, -0.0458, … 384]L
PRODUCT#prod-outdoor-015
outdoorS
Expedition sleeping bagS
233N
yesS
[-0.0225, 0.0847, -0.038, … 384]L
PRODUCT#prod-outdoor-016
outdoorS
Compact sleeping bagS
270N
yesS
[-0.0202, 0.1136, -0.0738, … 384]L
PRODUCT#prod-outdoor-017
outdoorS
Insulated sleeping bagS
307N
yesS
[-0.0061, 0.1108, -0.0604, … 384]L
PRODUCT#prod-outdoor-018
outdoorS
Waterproof sleeping bagS
44N
yesS
[-0.046, 0.1105, -0.0122, … 384]L
PRODUCT#prod-outdoor-019
outdoorS
Folding sleeping bagS
81N
yesS
[-0.0387, 0.0861, -0.0611, … 384]L
PRODUCT#prod-outdoor-020
outdoorS
Childrens sleeping bagS
118N
noS
[0.015, 0.088, -0.0493, … 384]L
PRODUCT#prod-outdoor-021
outdoorS
Ultralight backpackS
155N
yesS
[-0.0337, 0.0445, -0.0565, … 384]L
PRODUCT#prod-outdoor-022
outdoorS
Two-person backpackS
192N
yesS
[-0.0098, 0.0597, -0.0638, … 384]L
PRODUCT#prod-outdoor-023
outdoorS
Winter backpackS
229N
yesS
[-0.0786, 0.0936, -0.0568, … 384]L
PRODUCT#prod-outdoor-024
outdoorS
Budget backpackS
266N
yesS
[-0.0155, 0.0965, -0.0588, … 384]L
PRODUCT#prod-outdoor-025
outdoorS
Expedition backpackS
303N
yesS
[-0.0268, 0.0471, -0.0509, … 384]L
PRODUCT#prod-outdoor-026
outdoorS
Compact backpackS
40N
yesS
[-0.0275, 0.0843, -0.0899, … 384]L
PRODUCT#prod-outdoor-027
outdoorS
Insulated backpackS
77N
yesS
[-0.0449, 0.0883, -0.0457, … 384]L
PRODUCT#prod-outdoor-028
outdoorS
Waterproof backpackS
114N
yesS
[-0.0798, 0.0895, -0.0064, … 384]L
PRODUCT#prod-outdoor-029
outdoorS
Folding backpackS
151N
yesS
[-0.069, 0.0683, -0.0675, … 384]L
PRODUCT#prod-outdoor-030
outdoorS
Childrens backpackS
188N
yesS
[-0.0361, 0.0835, -0.0542, … 384]L
PRODUCT#prod-outdoor-031
outdoorS
Ultralight camping stoveS
225N
yesS
[0.0018, 0.0466, -0.0953, … 384]L
PRODUCT#prod-outdoor-032
outdoorS
Two-person camping stoveS
262N
yesS
[0, 0.0632, -0.1014, … 384]L
PRODUCT#prod-outdoor-033
outdoorS
Winter camping stoveS
299N
yesS
[-0.0497, 0.0794, -0.1077, … 384]L
PRODUCT#prod-outdoor-034
outdoorS
Budget camping stoveS
36N
yesS
[0.0117, 0.0855, -0.0816, … 384]L
PRODUCT#prod-outdoor-035
outdoorS
Expedition camping stoveS
73N
yesS
[-0.0096, 0.0401, -0.078, … 384]L
PRODUCT#prod-outdoor-036
outdoorS
Compact camping stoveS
110N
yesS
[-0.0233, 0.0768, -0.1352, … 384]L
PRODUCT#prod-outdoor-037
outdoorS
Insulated camping stoveS
147N
yesS
[-0.0206, 0.0827, -0.1181, … 384]L
PRODUCT#prod-outdoor-038
outdoorS
Waterproof camping stoveS
184N
yesS
[-0.0451, 0.0736, -0.0708, … 384]L
PRODUCT#prod-outdoor-039
outdoorS
Folding camping stoveS
221N
noS
[-0.0707, 0.0604, -0.1123, … 384]L
PRODUCT#prod-outdoor-040
outdoorS
Childrens camping stoveS
258N
yesS
[-0.0076, 0.0775, -0.0891, … 384]L
PRODUCT#prod-outdoor-041
outdoorS
Ultralight head torchS
295N
yesS
[0.0014, 0.0411, -0.0011, … 384]L
PRODUCT#prod-outdoor-042
outdoorS
Two-person head torchS
32N
yesS
[-0.0184, 0.0839, 0.011, … 384]L
PRODUCT#prod-outdoor-043
outdoorS
Winter head torchS
69N
yesS
[-0.0598, 0.1004, 0.0282, … 384]L
PRODUCT#prod-outdoor-044
outdoorS
Budget head torchS
106N
yesS
[-0.0147, 0.0959, 0.0092, … 384]L
PRODUCT#prod-outdoor-045
outdoorS
Expedition head torchS
143N
yesS
[-0.0177, 0.0459, 0.0295, … 384]L
PRODUCT#prod-outdoor-046
outdoorS
Compact head torchS
180N
yesS
[-0.0335, 0.0821, -0.008, … 384]L
PRODUCT#prod-outdoor-047
outdoorS
Insulated head torchS
217N
yesS
[-0.0198, 0.0857, 0.0149, … 384]L
PRODUCT#prod-outdoor-048
outdoorS
Waterproof head torchS
254N
yesS
[-0.0454, 0.0791, 0.0581, … 384]L
PRODUCT#prod-outdoor-049
outdoorS
Folding head torchS
291N
yesS
[-0.0726, 0.0597, 0.0197, … 384]L
PRODUCT#prod-outdoor-050
outdoorS
Childrens head torchS
28N
yesS
[-0.0277, 0.0903, 0.0312, … 384]L
PRODUCT#prod-outdoor-051
outdoorS
Ultralight water filterS
65N
yesS
[-0.0637, 0.029, 0.0293, … 384]L
PRODUCT#prod-outdoor-052
outdoorS
Two-person water filterS
102N
yesS
[-0.0504, 0.0531, 0.0217, … 384]L
PRODUCT#prod-outdoor-053
outdoorS
Winter water filterS
139N
yesS
[-0.1231, 0.0956, 0.0308, … 384]L
PRODUCT#prod-outdoor-054
outdoorS
Budget water filterS
176N
yesS
[-0.0557, 0.0936, 0.0483, … 384]L
PRODUCT#prod-outdoor-055
outdoorS
Expedition water filterS
213N
yesS
[-0.071, 0.0396, 0.0313, … 384]L
PRODUCT#prod-outdoor-056
outdoorS
Compact water filterS
250N
yesS
[-0.0985, 0.0897, -0.0038, … 384]L
PRODUCT#prod-outdoor-057
outdoorS
Insulated water filterS
287N
yesS
[-0.0941, 0.071, -0.004, … 384]L
PRODUCT#prod-outdoor-058
outdoorS
Waterproof water filterS
24N
noS
[-0.1077, 0.0811, 0.0688, … 384]L
PRODUCT#prod-outdoor-059
outdoorS
Folding water filterS
61N
yesS
[-0.1465, 0.0537, 0.0213, … 384]L
PRODUCT#prod-outdoor-060
outdoorS
Childrens water filterS
98N
yesS
[-0.0848, 0.0833, 0.0595, … 384]L
PRODUCT#prod-outdoor-061
outdoorS
Ultralight trekking poleS
135N
yesS
[-0.0187, 0.0376, 0.0024, … 384]L
PRODUCT#prod-outdoor-062
outdoorS
Two-person trekking poleS
172N
yesS
[-0.012, 0.0318, 0.0029, … 384]L
PRODUCT#prod-outdoor-063
outdoorS
Winter trekking poleS
209N
yesS
[-0.0578, 0.0668, 0.031, … 384]L
PRODUCT#prod-outdoor-064
outdoorS
Budget trekking poleS
246N
yesS
[-0.0155, 0.07, 0.0009, … 384]L
PRODUCT#prod-outdoor-065
outdoorS
Expedition trekking poleS
283N
yesS
[-0.0275, 0.0435, 0.0047, … 384]L
PRODUCT#prod-outdoor-066
outdoorS
Compact trekking poleS
20N
yesS
[-0.0384, 0.0753, -0.0195, … 384]L
PRODUCT#prod-outdoor-067
outdoorS
Insulated trekking poleS
57N
yesS
[-0.0712, 0.0602, 0.0307, … 384]L
PRODUCT#prod-outdoor-068
outdoorS
Waterproof trekking poleS
94N
yesS
[-0.0641, 0.0564, 0.0506, … 384]L
PRODUCT#prod-outdoor-069
outdoorS
Folding trekking poleS
131N
yesS
[-0.087, 0.0412, -0.0087, … 384]L
PRODUCT#prod-outdoor-070
outdoorS
Childrens trekking poleS
168N
yesS
[-0.0193, 0.0197, 0.0192, … 384]L
PRODUCT#prod-outdoor-071
outdoorS
Ultralight rain jacketS
205N
yesS
[-0.0601, 0.0784, 0.0469, … 384]L
PRODUCT#prod-outdoor-072
outdoorS
Two-person rain jacketS
242N
yesS
[-0.0394, 0.0771, 0.0504, … 384]L
PRODUCT#prod-outdoor-073
outdoorS
Winter rain jacketS
279N
yesS
[-0.0974, 0.0991, 0.051, … 384]L
PRODUCT#prod-outdoor-074
outdoorS
Budget rain jacketS
16N
yesS
[-0.0445, 0.1099, 0.0534, … 384]L
PRODUCT#prod-outdoor-075
outdoorS
Expedition rain jacketS
53N
yesS
[-0.0667, 0.0699, 0.0507, … 384]L
PRODUCT#prod-outdoor-076
outdoorS
Compact rain jacketS
90N
yesS
[-0.063, 0.1166, 0.0215, … 384]L
PRODUCT#prod-outdoor-077
outdoorS
Insulated rain jacketS
127N
noS
[-0.066, 0.1, 0.045, … 384]L
PRODUCT#prod-outdoor-078
outdoorS
Waterproof rain jacketS
164N
yesS
[-0.0727, 0.1089, 0.068, … 384]L
PRODUCT#prod-outdoor-079
outdoorS
Folding rain jacketS
201N
yesS
[-0.0985, 0.0978, 0.0383, … 384]L
PRODUCT#prod-outdoor-080
outdoorS
Childrens rain jacketS
238N
yesS
[-0.0517, 0.0998, 0.0518, … 384]L
PRODUCT#prod-outdoor-081
outdoorS
Ultralight camp chairS
275N
yesS
[0.0254, 0.0197, -0.0521, … 384]L
PRODUCT#prod-outdoor-082
outdoorS
Two-person camp chairS
312N
yesS
[0.0178, 0.0367, -0.0631, … 384]L
PRODUCT#prod-outdoor-083
outdoorS
Winter camp chairS
49N
yesS
[-0.0247, 0.0517, -0.0369, … 384]L
PRODUCT#prod-outdoor-084
outdoorS
Budget camp chairS
86N
yesS
[0.026, 0.0655, -0.0626, … 384]L
PRODUCT#prod-outdoor-085
outdoorS
Expedition camp chairS
123N
yesS
[0.0027, 0.036, -0.045, … 384]L
PRODUCT#prod-outdoor-086
outdoorS
Compact camp chairS
160N
yesS
[0.0212, 0.0538, -0.0759, … 384]L
PRODUCT#prod-outdoor-087
outdoorS
Insulated camp chairS
197N
yesS
[-0.0076, 0.0653, -0.0365, … 384]L
PRODUCT#prod-outdoor-088
outdoorS
Waterproof camp chairS
234N
yesS
[-0.0156, 0.0573, 0.018, … 384]L
PRODUCT#prod-outdoor-089
outdoorS
Folding camp chairS
271N
yesS
[-0.0285, 0.0339, -0.0537, … 384]L
PRODUCT#prod-outdoor-090
outdoorS
Childrens camp chairS
308N
yesS
[-0.0025, 0.0411, -0.0606, … 384]L
PRODUCT#prod-outdoor-091
outdoorS
Ultralight dry bagS
45N
yesS
[-0.0167, 0.0655, -0.0395, … 384]L
PRODUCT#prod-outdoor-092
outdoorS
Two-person dry bagS
82N
yesS
[-0.0109, 0.0693, -0.0333, … 384]L
PRODUCT#prod-outdoor-093
outdoorS
Winter dry bagS
119N
yesS
[-0.0781, 0.1055, -0.0179, … 384]L
PRODUCT#prod-outdoor-094
outdoorS
Budget dry bagS
156N
yesS
[-0.0159, 0.1005, -0.0221, … 384]L
PRODUCT#prod-outdoor-095
outdoorS
Expedition dry bagS
193N
yesS
[-0.0325, 0.0621, -0.0286, … 384]L
PRODUCT#prod-outdoor-096
outdoorS
Compact dry bagS
230N
noS
[-0.033, 0.0912, -0.0763, … 384]L
PRODUCT#prod-outdoor-097
outdoorS
Insulated dry bagS
267N
yesS
[-0.0282, 0.0891, -0.0584, … 384]L
PRODUCT#prod-outdoor-098
outdoorS
Waterproof dry bagS
304N
yesS
[-0.0552, 0.0869, -0.0008, … 384]L
PRODUCT#prod-outdoor-099
outdoorS
Folding dry bagS
41N
yesS
[-0.0655, 0.057, -0.0486, … 384]L
PRODUCT#prod-outdoor-100
outdoorS
Childrens dry bagS
78N
yesS
[-0.019, 0.078, -0.0142, … 384]L
PRODUCT#prod-outdoor-101
outdoorS
Ultralight compassS
115N
yesS
[-0.0242, -0.0311, -0.0631, … 384]L
PRODUCT#prod-outdoor-102
outdoorS
Two-person compassS
152N
yesS
[-0.0087, 0.0052, -0.0488, … 384]L
PRODUCT#prod-outdoor-103
outdoorS
Winter compassS
189N
yesS
[-0.0674, 0.0164, -0.0148, … 384]L
PRODUCT#prod-outdoor-104
outdoorS
Budget compassS
226N
yesS
[-0.0015, 0.0165, -0.0747, … 384]L
PRODUCT#prod-outdoor-105
outdoorS
Expedition compassS
263N
yesS
[-0.02, -0.0136, -0.0407, … 384]L
PRODUCT#prod-outdoor-106
outdoorS
Compact compassS
300N
yesS
[-0.0405, 0.0062, -0.081, … 384]L
PRODUCT#prod-outdoor-107
outdoorS
Insulated compassS
37N
yesS
[-0.0543, 0.0208, -0.0204, … 384]L
PRODUCT#prod-outdoor-108
outdoorS
Waterproof compassS
74N
yesS
[-0.0593, 0.0094, 0.0384, … 384]L
PRODUCT#prod-outdoor-109
outdoorS
Folding compassS
111N
yesS
[-0.0748, -0.0001, -0.0525, … 384]L
PRODUCT#prod-outdoor-110
outdoorS
Childrens compassS
148N
yesS
[-0.0147, 0.0225, -0.0216, … 384]L
PRODUCT#prod-cycling-001
cyclingS
Road helmetS
89N
yesS
[-0.0335, 0.1052, 0.0018, … 384]L
PRODUCT#prod-cycling-002
cyclingS
Gravel tyreS
54N
yesS
[-0.047, 0.0253, -0.0341, … 384]L
PRODUCT#prod-cycling-003
cyclingS
Chain lubricantS
9N
yesS
[-0.0988, -0.0568, 0.0991, … 384]L
PRODUCT#prod-cycling-004
cyclingS
Bike lockS
45N
yesS
[-0.0743, 0.0981, -0.0576, … 384]L
PRODUCT#prod-cycling-005
cyclingS
Cycling jerseyS
62N
yesS
[-0.0664, 0.1639, -0.0435, … 384]L
PRODUCT#prod-cycling-006
cyclingS
Bottle cageS
12N
noS
[-0.0052, 0.0914, -0.0907, … 384]L
PRODUCT#prod-cycling-007
cyclingS
Track pumpS
38N
yesS
[-0.0755, 0.043, -0.0245, … 384]L
PRODUCT#prod-cycling-008
cyclingS
Saddle bagS
24N
yesS
[-0.053, 0.0987, -0.063, … 384]L
PRODUCT#prod-climbing-001
climbingS
Climbing harnessS
72N
yesS
[-0.0928, -0.0015, -0.0279, … 384]L
PRODUCT#prod-climbing-002
climbingS
Chalk bagS
18N
yesS
[-0.0074, 0.0022, -0.0283, … 384]L
PRODUCT#prod-climbing-003
climbingS
Belay deviceS
34N
yesS
[-0.0846, 0.0469, -0.0141, … 384]L
PRODUCT#prod-climbing-004
climbingS
Quickdraw setS
96N
noS
[-0.0322, 0.041, -0.0626, … 384]L
PRODUCT#prod-climbing-005
climbingS
Approach shoeS
110N
yesS
[-0.0486, 0.016, 0.035, … 384]L
PRODUCT#prod-climbing-006
climbingS
Crash padS
240N
yesS
[0.0126, -0.0022, -0.0184, … 384]L
PRODUCT#prod-climbing-007
climbingS
Nut toolS
14N
yesS
[-0.0645, 0.0075, 0.0005, … 384]L
PRODUCT#prod-climbing-008
climbingS
Dynamic ropeS
185N
yesS
[-0.0829, 0.0382, -0.0271, … 384]L

Run an operation to see the raw engine response.

table ProductCataloguekeys pkitems 126