forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit06998ea
committed
Improve heuristics for compressing the KnownAssignedXids array.
Previously, we'd compress only when the active range of array entriesreached Max(4 * PROCARRAY_MAXPROCS, 2 * pArray->numKnownAssignedXids).If max_connections is large, the first term could result in notcompressing for a long time, resulting in much wastage of cycles inhot-standby backends scanning the array to take snapshots. Get ridof that term, and just bound it to 2 * pArray->numKnownAssignedXids.That however creates the opposite risk, that we might spend too mucheffort compressing. Hence, consider compressing only once every 128commit records. (This frequency was chosen by benchmarking. Whilewe only tried one benchmark scenario, the results seem stable overa fairly wide range of frequencies.)Also, force compression when processing RecoveryInfo WAL records(which should be infrequent); the old code could perform compressionthen, but would do so only after the same array-range check as forthe transaction-commit path.Also, opportunistically run compression if the startup process is aboutto wait for WAL, though not oftener than once a second. This shouldprevent cases where we waste lots of time by leaving the arraynot-compressed for long intervals due to low WAL traffic.Lastly, add a simple check to keep us from uselessly compressingwhen the array storage is already compact.Back-patch, as the performance problem is worse in pre-v14 branchesthan in HEAD.Simon Riggs and Michail Nikolaev, with help from Tom Lane andAndres Freund.Discussion:https://postgr.es/m/CALdSSPgahNUD_=pB_j=1zSnDBaiOtqVfzo8Ejt5J_k7qZiU1Tw@mail.gmail.com1 parent7715a3c commit06998ea
File tree
3 files changed
+110
-30
lines changed- src
- backend
- access/transam
- storage/ipc
- include/storage
3 files changed
+110
-30
lines changedLines changed: 6 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12741 | 12741 |
| |
12742 | 12742 |
| |
12743 | 12743 |
| |
| 12744 | + | |
| 12745 | + | |
| 12746 | + | |
12744 | 12747 |
| |
12745 | 12748 |
| |
12746 | 12749 |
| |
| |||
13002 | 13005 |
| |
13003 | 13006 |
| |
13004 | 13007 |
| |
| 13008 | + | |
| 13009 | + | |
| 13010 | + | |
13005 | 13011 |
| |
13006 | 13012 |
| |
13007 | 13013 |
| |
|
Lines changed: 103 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
260 | 271 |
| |
261 | 272 |
| |
262 | 273 |
| |
| |||
341 | 352 |
| |
342 | 353 |
| |
343 | 354 |
| |
344 |
| - | |
| 355 | + | |
345 | 356 |
| |
346 | 357 |
| |
347 | 358 |
| |
| |||
4556 | 4567 |
| |
4557 | 4568 |
| |
4558 | 4569 |
| |
| 4570 | + | |
| 4571 | + | |
| 4572 | + | |
| 4573 | + | |
| 4574 | + | |
| 4575 | + | |
| 4576 | + | |
| 4577 | + | |
| 4578 | + | |
| 4579 | + | |
| 4580 | + | |
4559 | 4581 |
| |
4560 | 4582 |
| |
4561 | 4583 |
| |
| |||
4638 | 4660 |
| |
4639 | 4661 |
| |
4640 | 4662 |
| |
4641 |
| - | |
| 4663 | + | |
| 4664 | + | |
| 4665 | + | |
4642 | 4666 |
| |
4643 | 4667 |
| |
4644 | 4668 |
| |
4645 | 4669 |
| |
4646 | 4670 |
| |
4647 | 4671 |
| |
4648 | 4672 |
| |
4649 |
| - | |
4650 |
| - | |
| 4673 | + | |
| 4674 | + | |
4651 | 4675 |
| |
4652 |
| - | |
| 4676 | + | |
| 4677 | + | |
4653 | 4678 |
| |
4654 | 4679 |
| |
4655 |
| - | |
| 4680 | + | |
4656 | 4681 |
| |
4657 | 4682 |
| |
4658 | 4683 |
| |
4659 |
| - | |
| 4684 | + | |
| 4685 | + | |
4660 | 4686 |
| |
4661 | 4687 |
| |
4662 | 4688 |
| |
4663 |
| - | |
| 4689 | + | |
| 4690 | + | |
| 4691 | + | |
| 4692 | + | |
| 4693 | + | |
| 4694 | + | |
| 4695 | + | |
| 4696 | + | |
| 4697 | + | |
| 4698 | + | |
| 4699 | + | |
| 4700 | + | |
4664 | 4701 |
| |
4665 | 4702 |
| |
| 4703 | + | |
4666 | 4704 |
| |
4667 |
| - | |
| 4705 | + | |
| 4706 | + | |
| 4707 | + | |
| 4708 | + | |
| 4709 | + | |
| 4710 | + | |
| 4711 | + | |
4668 | 4712 |
| |
4669 | 4713 |
| |
4670 |
| - | |
4671 |
| - | |
4672 |
| - | |
4673 |
| - | |
4674 |
| - | |
4675 |
| - | |
4676 |
| - | |
4677 |
| - | |
| 4714 | + | |
| 4715 | + | |
| 4716 | + | |
| 4717 | + | |
| 4718 | + | |
| 4719 | + | |
| 4720 | + | |
| 4721 | + | |
| 4722 | + | |
| 4723 | + | |
| 4724 | + | |
| 4725 | + | |
4678 | 4726 |
| |
4679 |
| - | |
| 4727 | + | |
| 4728 | + | |
4680 | 4729 |
| |
4681 |
| - | |
4682 |
| - | |
| 4730 | + | |
| 4731 | + | |
| 4732 | + | |
| 4733 | + | |
| 4734 | + | |
4683 | 4735 |
| |
4684 | 4736 |
| |
| 4737 | + | |
| 4738 | + | |
| 4739 | + | |
| 4740 | + | |
| 4741 | + | |
| 4742 | + | |
| 4743 | + | |
| 4744 | + | |
| 4745 | + | |
| 4746 | + | |
| 4747 | + | |
| 4748 | + | |
| 4749 | + | |
| 4750 | + | |
| 4751 | + | |
| 4752 | + | |
| 4753 | + | |
| 4754 | + | |
| 4755 | + | |
| 4756 | + | |
| 4757 | + | |
4685 | 4758 |
| |
4686 | 4759 |
| |
4687 | 4760 |
| |
| |||
4697 | 4770 |
| |
4698 | 4771 |
| |
4699 | 4772 |
| |
| 4773 | + | |
4700 | 4774 |
| |
4701 | 4775 |
| |
4702 | 4776 |
| |
| 4777 | + | |
| 4778 | + | |
| 4779 | + | |
| 4780 | + | |
| 4781 | + | |
| 4782 | + | |
4703 | 4783 |
| |
4704 | 4784 |
| |
4705 | 4785 |
| |
| |||
4771 | 4851 |
| |
4772 | 4852 |
| |
4773 | 4853 |
| |
4774 |
| - | |
4775 |
| - | |
4776 |
| - | |
4777 |
| - | |
4778 |
| - | |
| 4854 | + | |
4779 | 4855 |
| |
4780 | 4856 |
| |
4781 | 4857 |
| |
4782 | 4858 |
| |
4783 |
| - | |
4784 |
| - | |
4785 |
| - | |
4786 | 4859 |
| |
4787 | 4860 |
| |
4788 | 4861 |
| |
| |||
4976 | 5049 |
| |
4977 | 5050 |
| |
4978 | 5051 |
| |
4979 |
| - | |
| 5052 | + | |
4980 | 5053 |
| |
4981 | 5054 |
| |
4982 | 5055 |
| |
| |||
5051 | 5124 |
| |
5052 | 5125 |
| |
5053 | 5126 |
| |
5054 |
| - | |
| 5127 | + | |
5055 | 5128 |
| |
5056 | 5129 |
| |
5057 | 5130 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
39 | 39 |
| |
40 | 40 |
| |
41 | 41 |
| |
| 42 | + | |
42 | 43 |
| |
43 | 44 |
| |
44 | 45 |
| |
|
0 commit comments
Comments
(0)