forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd09dbeb
committed
Speedup hash index builds by skipping needless binary searches
When building hash indexes using the spool method, tuples are added to theindex page in hashkey order. Because of this, we can safely skipperforming the binary search on the existing tuples on the page to findthe location to insert the tuple based on its hashkey value. For thiscase, we can just always put the tuple at the end of the item array as thetuples will always arrive in hashkey order.Testing has shown that this can improve hash index build speeds by 5-15%with a unique set of integer values.Author: Simon RiggsReviewed-by: David RowleyTested-by: David Zhang, Tomas VondraDiscussion:https://postgr.es/m/CANbhV-GBc5JoG0AneUGPZZW3o4OK5LjBGeKe_icpC3R1McrZWQ@mail.gmail.com1 parentd46ad72 commitd09dbeb
File tree
4 files changed
+41
-13
lines changed- src
- backend/access/hash
- include/access
4 files changed
+41
-13
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
234 |
| - | |
| 234 | + | |
235 | 235 |
| |
236 | 236 |
| |
237 | 237 |
| |
| |||
265 | 265 |
| |
266 | 266 |
| |
267 | 267 |
| |
268 |
| - | |
| 268 | + | |
269 | 269 |
| |
270 | 270 |
| |
271 | 271 |
| |
|
Lines changed: 33 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 |
| |
36 | 39 |
| |
37 |
| - | |
| 40 | + | |
38 | 41 |
| |
39 | 42 |
| |
40 | 43 |
| |
| |||
198 | 201 |
| |
199 | 202 |
| |
200 | 203 |
| |
201 |
| - | |
| 204 | + | |
202 | 205 |
| |
203 | 206 |
| |
204 | 207 |
| |
| |||
263 | 266 |
| |
264 | 267 |
| |
265 | 268 |
| |
266 |
| - | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
267 | 274 |
| |
268 | 275 |
| |
269 |
| - | |
| 276 | + | |
| 277 | + | |
270 | 278 |
| |
271 | 279 |
| |
272 | 280 |
| |
273 |
| - | |
274 | 281 |
| |
275 | 282 |
| |
276 | 283 |
| |
277 | 284 |
| |
278 |
| - | |
279 |
| - | |
280 |
| - | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
281 | 306 |
| |
282 | 307 |
| |
283 | 308 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
145 | 145 |
| |
146 | 146 |
| |
147 | 147 |
| |
148 |
| - | |
| 148 | + | |
| 149 | + | |
149 | 150 |
| |
150 | 151 |
| |
151 | 152 |
| |
|
Lines changed: 4 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
390 | 390 |
| |
391 | 391 |
| |
392 | 392 |
| |
393 |
| - | |
| 393 | + | |
| 394 | + | |
394 | 395 |
| |
395 |
| - | |
| 396 | + | |
| 397 | + | |
396 | 398 |
| |
397 | 399 |
| |
398 | 400 |
| |
|
0 commit comments
Comments
(0)