- Notifications
You must be signed in to change notification settings - Fork5
Commit2ed5b87
committed
Reduce pinning and buffer content locking for btree scans.
Even though the main benefit of the Lehman and Yao algorithm forbtrees is that no locks need be held between page reads in anindex search, we were holding a buffer pin on each leaf page afterit was read until we were ready to read the next one. The reasonwas so that we could treat this as a weak lock to create an"interlock" with vacuum's deletion of heap line pointers, eventhough our README file pointed out that this was not necessary fora scan using an MVCC snapshot.The main goal of this patch is to reduce the blocking of vacuumprocesses by in-progress btree index scans (including a cursorwhich is idle), but the code rearrangement also allows for oneless buffer content lock to be taken when a forward scan steps fromone page to the next, which results in a small but consistentperformance improvement in many workloads.This patch leaves behavior unchanged for some cases, which can beaddressed separately so that each case can be evaluated on its ownmerits. These unchanged cases are when a scan uses a non-MVCCsnapshot, an index-only scan, and a scan of a btree index for whichmodifications are not WAL-logged. If later patches allow all ofthese cases to drop the buffer pin after reading a leaf page, thenthe btree vacuum process can be simplified; it will no longer needthe "super-exclusive" lock to delete tuples from a page.Reviewed by Heikki Linnakangas and Kyotaro Horiguchi1 parent8217fb1 commit2ed5b87
File tree
8 files changed
+327
-133
lines changed- src
- backend
- access/nbtree
- storage/buffer
- include/access
8 files changed
+327
-133
lines changedLines changed: 50 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
106 | 107 |
| |
107 | 108 |
| |
108 | 109 |
| |
| |||
154 | 155 |
| |
155 | 156 |
| |
156 | 157 |
| |
157 |
| - | |
158 |
| - | |
159 |
| - | |
160 |
| - | |
161 |
| - | |
162 |
| - | |
163 |
| - | |
164 |
| - | |
165 |
| - | |
166 |
| - | |
167 |
| - | |
168 |
| - | |
169 |
| - | |
170 |
| - | |
171 |
| - | |
172 |
| - | |
173 |
| - | |
174 |
| - | |
175 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
176 | 189 |
| |
177 | 190 |
| |
178 | 191 |
| |
| |||
396 | 409 |
| |
397 | 410 |
| |
398 | 411 |
| |
399 |
| - | |
400 |
| - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
401 | 418 |
| |
402 | 419 |
| |
403 | 420 |
| |
| |||
462 | 479 |
| |
463 | 480 |
| |
464 | 481 |
| |
465 |
| - | |
| 482 | + | |
466 | 483 |
| |
467 | 484 |
| |
468 | 485 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
498 | 498 |
| |
499 | 499 |
| |
500 | 500 |
| |
501 |
| - | |
| 501 | + | |
502 | 502 |
| |
503 |
| - | |
| 503 | + | |
504 | 504 |
| |
505 | 505 |
| |
506 | 506 |
| |
|
Lines changed: 53 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
404 | 404 |
| |
405 | 405 |
| |
406 | 406 |
| |
407 |
| - | |
| 407 | + | |
| 408 | + | |
408 | 409 |
| |
409 | 410 |
| |
410 | 411 |
| |
| |||
424 | 425 |
| |
425 | 426 |
| |
426 | 427 |
| |
427 |
| - | |
428 |
| - | |
429 | 428 |
| |
430 | 429 |
| |
431 | 430 |
| |
| |||
451 | 450 |
| |
452 | 451 |
| |
453 | 452 |
| |
454 |
| - | |
455 |
| - | |
456 |
| - | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
457 | 456 |
| |
458 | 457 |
| |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 | 458 |
| |
| 459 | + | |
| 460 | + | |
465 | 461 |
| |
466 | 462 |
| |
467 | 463 |
| |
| |||
515 | 511 |
| |
516 | 512 |
| |
517 | 513 |
| |
518 |
| - | |
519 |
| - | |
520 |
| - | |
| 514 | + | |
| 515 | + | |
521 | 516 |
| |
522 | 517 |
| |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 | 518 |
| |
| 519 | + | |
| 520 | + | |
| 521 | + | |
529 | 522 |
| |
530 | 523 |
| |
531 | 524 |
| |
| |||
552 | 545 |
| |
553 | 546 |
| |
554 | 547 |
| |
555 |
| - | |
556 |
| - | |
557 |
| - | |
558 |
| - | |
559 |
| - | |
560 |
| - | |
| 548 | + | |
| 549 | + | |
561 | 550 |
| |
562 | 551 |
| |
563 | 552 |
| |
| |||
568 | 557 |
| |
569 | 558 |
| |
570 | 559 |
| |
| 560 | + | |
| 561 | + | |
571 | 562 |
| |
| 563 | + | |
572 | 564 |
| |
573 | 565 |
| |
574 | 566 |
| |
| |||
593 | 585 |
| |
594 | 586 |
| |
595 | 587 |
| |
596 |
| - | |
| 588 | + | |
597 | 589 |
| |
| 590 | + | |
| 591 | + | |
| 592 | + | |
598 | 593 |
| |
599 | 594 |
| |
600 | 595 |
| |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
601 | 615 |
| |
602 | 616 |
| |
603 |
| - | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
604 | 623 |
| |
605 | 624 |
| |
606 | 625 |
| |
607 |
| - | |
608 |
| - | |
609 |
| - | |
610 |
| - | |
611 |
| - | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
612 | 629 |
| |
613 | 630 |
| |
614 | 631 |
| |
615 | 632 |
| |
616 | 633 |
| |
617 |
| - | |
| 634 | + | |
| 635 | + | |
618 | 636 |
| |
619 | 637 |
| |
620 | 638 |
| |
621 | 639 |
| |
622 | 640 |
| |
623 | 641 |
| |
624 | 642 |
| |
| 643 | + | |
| 644 | + | |
625 | 645 |
| |
626 | 646 |
| |
627 | 647 |
| |
|
0 commit comments
Comments
(0)