forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit13aa624
committed
Optimize updating a row that's locked by same xid
Updating or locking a row that was already locked by the sametransaction under the same Xid caused a MultiXact to be created; butthis is unnecessary, because there's no usefulness in being able todifferentiate two locks by the same transaction. In particular, if atransaction executed SELECT FOR UPDATE followed by an UPDATE that didn'tmodify columns of the key, we would dutifully represent the resultingcombination as a multixact -- even though a single key-update issufficient.Optimize the case so that only the strongest of both locks/updates isrepresented in Xmax. This can save some Xmax's from becomingMultiXacts, which can be a significant optimization.This missed optimization opportunity was spotted by Andres Freund whileinvestigating a bug reported by Oliver Seemann in messageCANCipfpfzoYnOz5jj=UZ70_R=CwDHv36dqWSpwsi27vpm1z5sA@mail.gmail.comand also directly as a performance regression reported by Dong Ye inmessaged54b8387.000012d8.00000010@YED-DEVD1.vmware.comReportedly, this patch fixes the performance regression.Since the missing optimization was reported as a significant performanceregression from 9.2, backpatch to 9.3.Andres Freund, tweaked by Álvaro Herrera1 parent084e385 commit13aa624
1 file changed
+39
-31
lines changedLines changed: 39 additions & 31 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
4705 | 4705 |
| |
4706 | 4706 |
| |
4707 | 4707 |
| |
| 4708 | + | |
| 4709 | + | |
4708 | 4710 |
| |
4709 | 4711 |
| |
4710 | 4712 |
| |
4711 | 4713 |
| |
4712 | 4714 |
| |
4713 | 4715 |
| |
4714 | 4716 |
| |
| 4717 | + | |
| 4718 | + | |
| 4719 | + | |
| 4720 | + | |
| 4721 | + | |
4715 | 4722 |
| |
4716 | 4723 |
| |
4717 | 4724 |
| |
| |||
4837 | 4844 |
| |
4838 | 4845 |
| |
4839 | 4846 |
| |
4840 |
| - | |
4841 | 4847 |
| |
| 4848 | + | |
| 4849 | + | |
4842 | 4850 |
| |
4843 | 4851 |
| |
4844 | 4852 |
| |
4845 | 4853 |
| |
4846 |
| - | |
| 4854 | + | |
4847 | 4855 |
| |
4848 |
| - | |
| 4856 | + | |
4849 | 4857 |
| |
4850 | 4858 |
| |
4851 | 4859 |
| |
4852 |
| - | |
| 4860 | + | |
4853 | 4861 |
| |
4854 |
| - | |
| 4862 | + | |
4855 | 4863 |
| |
4856 | 4864 |
| |
4857 | 4865 |
| |
| |||
4871 | 4879 |
| |
4872 | 4880 |
| |
4873 | 4881 |
| |
4874 |
| - | |
| 4882 | + | |
4875 | 4883 |
| |
4876 |
| - | |
| 4884 | + | |
4877 | 4885 |
| |
4878 | 4886 |
| |
4879 |
| - | |
| 4887 | + | |
4880 | 4888 |
| |
4881 | 4889 |
| |
4882 |
| - | |
4883 |
| - | |
4884 |
| - | |
| 4890 | + | |
| 4891 | + | |
| 4892 | + | |
4885 | 4893 |
| |
4886 | 4894 |
| |
4887 | 4895 |
| |
4888 |
| - | |
4889 |
| - | |
4890 |
| - | |
4891 | 4896 |
| |
4892 |
| - | |
4893 |
| - | |
4894 |
| - | |
4895 |
| - | |
| 4897 | + | |
| 4898 | + | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
4896 | 4903 |
| |
4897 |
| - | |
4898 |
| - | |
4899 |
| - | |
4900 |
| - | |
4901 |
| - | |
4902 |
| - | |
4903 |
| - | |
4904 |
| - | |
4905 |
| - | |
4906 |
| - | |
4907 |
| - | |
4908 |
| - | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
| 4910 | + | |
| 4911 | + | |
| 4912 | + | |
4909 | 4913 |
| |
4910 |
| - | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
4911 | 4919 |
| |
4912 | 4920 |
| |
4913 | 4921 |
| |
|
0 commit comments
Comments
(0)