- Notifications
You must be signed in to change notification settings - Fork28
Commit5874c70
committed
Speed up sort-order-comparison tests in create_index_spgist.
This test script verifies that KNN searches of an SP-GiST indexproduce the same sort order as a seqscan-and-sort. The FULL JOINsused for that are exceedingly slow, however. Investigation showsthat the problem is that the initial join is on the rank() values,and we have a lot of duplicates due to the data set containing 1000duplicate points. We're therefore going to produce 1000000 joinrows that have to be thrown away again by the join filter.We can improve matters by using row_number() instead of rank(),so that the initial join keys are unique. The catch is thatthat makes the results sensitive to the sorting of rows withequal distances from the reference point. That doesn't matterfor the actually-equal points, but as luck would have it, thedata set also contains two distinct points that have identicaldistances to the origin. So those two rows could legitimatelyappear in either order, causing unwanted output from the checkqueries.However, it doesn't seem like it's the job of this test tocheck whether the <-> operator correctly computes distances;its charter is just to verify that SP-GiST emits the valuesin distance order. So we can dodge the indeterminacy problemby having the check only compare row numbers and distancesnot the actual point values.This change reduces the run time of create_index_spgist by a goodthree-quarters, on my machine, with ensuing beneficial effects onthe runtime of create_index (thanks to interactions with CREATEINDEX CONCURRENTLY tests in the latter). I see a net improvementof more than 2X in the runtime of their parallel test group.Discussion:https://postgr.es/m/735.1554935715@sss.pgh.pa.us1 parent385d396 commit5874c70
File tree
2 files changed
+48
-60
lines changed- src/test/regress
- expected
- sql
2 files changed
+48
-60
lines changedLines changed: 24 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
81 | 81 |
| |
82 | 82 |
| |
83 | 83 |
| |
84 |
| - | |
| 84 | + | |
85 | 85 |
| |
86 | 86 |
| |
87 |
| - | |
| 87 | + | |
88 | 88 |
| |
89 | 89 |
| |
90 |
| - | |
| 90 | + | |
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
| |||
327 | 327 |
| |
328 | 328 |
| |
329 | 329 |
| |
330 |
| - | |
| 330 | + | |
331 | 331 |
| |
332 | 332 |
| |
333 | 333 |
| |
| |||
337 | 337 |
| |
338 | 338 |
| |
339 | 339 |
| |
340 |
| - | |
| 340 | + | |
341 | 341 |
| |
342 | 342 |
| |
343 | 343 |
| |
344 |
| - | |
345 |
| - | |
| 344 | + | |
346 | 345 |
| |
347 | 346 |
| |
348 | 347 |
| |
349 | 348 |
| |
350 | 349 |
| |
351 |
| - | |
| 350 | + | |
352 | 351 |
| |
353 | 352 |
| |
354 | 353 |
| |
| |||
359 | 358 |
| |
360 | 359 |
| |
361 | 360 |
| |
362 |
| - | |
| 361 | + | |
363 | 362 |
| |
364 | 363 |
| |
365 | 364 |
| |
366 |
| - | |
367 |
| - | |
| 365 | + | |
368 | 366 |
| |
369 | 367 |
| |
370 | 368 |
| |
371 | 369 |
| |
372 | 370 |
| |
373 |
| - | |
| 371 | + | |
374 | 372 |
| |
375 | 373 |
| |
376 | 374 |
| |
| |||
381 | 379 |
| |
382 | 380 |
| |
383 | 381 |
| |
384 |
| - | |
| 382 | + | |
385 | 383 |
| |
386 | 384 |
| |
387 | 385 |
| |
388 |
| - | |
389 |
| - | |
| 386 | + | |
390 | 387 |
| |
391 | 388 |
| |
392 | 389 |
| |
| |||
497 | 494 |
| |
498 | 495 |
| |
499 | 496 |
| |
500 |
| - | |
| 497 | + | |
501 | 498 |
| |
502 | 499 |
| |
503 | 500 |
| |
| |||
507 | 504 |
| |
508 | 505 |
| |
509 | 506 |
| |
510 |
| - | |
| 507 | + | |
511 | 508 |
| |
512 | 509 |
| |
513 |
| - | |
514 |
| - | |
515 |
| - | |
| 510 | + | |
| 511 | + | |
516 | 512 |
| |
517 | 513 |
| |
518 | 514 |
| |
519 | 515 |
| |
520 | 516 |
| |
521 |
| - | |
| 517 | + | |
522 | 518 |
| |
523 | 519 |
| |
524 | 520 |
| |
| |||
529 | 525 |
| |
530 | 526 |
| |
531 | 527 |
| |
532 |
| - | |
| 528 | + | |
533 | 529 |
| |
534 | 530 |
| |
535 |
| - | |
536 |
| - | |
537 |
| - | |
| 531 | + | |
| 532 | + | |
538 | 533 |
| |
539 | 534 |
| |
540 | 535 |
| |
541 | 536 |
| |
542 | 537 |
| |
543 |
| - | |
| 538 | + | |
544 | 539 |
| |
545 | 540 |
| |
546 | 541 |
| |
| |||
551 | 546 |
| |
552 | 547 |
| |
553 | 548 |
| |
554 |
| - | |
| 549 | + | |
555 | 550 |
| |
556 | 551 |
| |
557 |
| - | |
558 |
| - | |
559 |
| - | |
| 552 | + | |
| 553 | + | |
560 | 554 |
| |
561 | 555 |
| |
562 | 556 |
| |
|
Lines changed: 24 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
56 |
| - | |
| 56 | + | |
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
| 64 | + | |
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| |||
138 | 138 |
| |
139 | 139 |
| |
140 | 140 |
| |
141 |
| - | |
| 141 | + | |
142 | 142 |
| |
143 | 143 |
| |
144 |
| - | |
| 144 | + | |
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
149 |
| - | |
| 148 | + | |
150 | 149 |
| |
151 | 150 |
| |
152 |
| - | |
| 151 | + | |
153 | 152 |
| |
154 | 153 |
| |
155 |
| - | |
| 154 | + | |
156 | 155 |
| |
157 | 156 |
| |
158 | 157 |
| |
159 |
| - | |
160 |
| - | |
| 158 | + | |
161 | 159 |
| |
162 | 160 |
| |
163 |
| - | |
| 161 | + | |
164 | 162 |
| |
165 | 163 |
| |
166 |
| - | |
| 164 | + | |
167 | 165 |
| |
168 | 166 |
| |
169 | 167 |
| |
170 |
| - | |
171 |
| - | |
| 168 | + | |
172 | 169 |
| |
173 | 170 |
| |
174 | 171 |
| |
| |||
199 | 196 |
| |
200 | 197 |
| |
201 | 198 |
| |
202 |
| - | |
| 199 | + | |
203 | 200 |
| |
204 | 201 |
| |
205 |
| - | |
| 202 | + | |
206 | 203 |
| |
207 | 204 |
| |
208 |
| - | |
209 |
| - | |
210 |
| - | |
| 205 | + | |
| 206 | + | |
211 | 207 |
| |
212 | 208 |
| |
213 |
| - | |
| 209 | + | |
214 | 210 |
| |
215 | 211 |
| |
216 |
| - | |
| 212 | + | |
217 | 213 |
| |
218 | 214 |
| |
219 |
| - | |
220 |
| - | |
221 |
| - | |
| 215 | + | |
| 216 | + | |
222 | 217 |
| |
223 | 218 |
| |
224 |
| - | |
| 219 | + | |
225 | 220 |
| |
226 | 221 |
| |
227 |
| - | |
| 222 | + | |
228 | 223 |
| |
229 | 224 |
| |
230 |
| - | |
231 |
| - | |
232 |
| - | |
| 225 | + | |
| 226 | + | |
233 | 227 |
| |
234 | 228 |
| |
235 | 229 |
| |
|
0 commit comments
Comments
(0)