forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd2086b0
committed
Reduce path length for locking leaf B-tree pages during insertion
In our B-tree implementation appropriate leaf page for new tupleinsertion is acquired using _bt_search() function. This function alwaysreturns leaf page locked in shared mode. In order to obtain exclusivelock, caller have to relock the page.This commit makes _bt_search() function lock leaf page immediately inexclusive mode when needed. That removes unnecessary relock and, inturn reduces lock contention for B-tree leaf pages. Our experimentson multi-core systems showed acceleration up to 4.5 times in cornercase.Discussion:https://postgr.es/m/CAPpHfduAMDFMNYTCN7VMBsFg_hsf0GqiqXnt%2BbSeaJworwFoig%40mail.gmail.comAuthor: Alexander KorotkovReviewed-by: Yoshikazu Imai, Simon Riggs, Peter Geoghegan1 parent8a9b72c commitd2086b0
2 files changed
+41
-22
lines changedLines changed: 4 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
216 | 216 |
| |
217 | 217 |
| |
218 | 218 |
| |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 |
| - | |
225 |
| - | |
226 |
| - | |
227 | 219 |
| |
228 |
| - | |
229 |
| - | |
230 |
| - | |
231 |
| - | |
232 |
| - | |
| 220 | + | |
| 221 | + | |
233 | 222 |
| |
234 |
| - | |
235 |
| - | |
| 223 | + | |
| 224 | + | |
236 | 225 |
| |
237 | 226 |
| |
238 | 227 |
| |
|
Lines changed: 37 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
87 | 87 |
| |
88 | 88 |
| |
89 | 89 |
| |
90 |
| - | |
91 |
| - | |
92 |
| - | |
93 |
| - | |
94 |
| - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
95 | 95 |
| |
96 | 96 |
| |
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
100 | 100 |
| |
| 101 | + | |
101 | 102 |
| |
102 | 103 |
| |
103 | 104 |
| |
| |||
132 | 133 |
| |
133 | 134 |
| |
134 | 135 |
| |
135 |
| - | |
| 136 | + | |
136 | 137 |
| |
137 | 138 |
| |
138 | 139 |
| |
| |||
166 | 167 |
| |
167 | 168 |
| |
168 | 169 |
| |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
169 | 178 |
| |
170 |
| - | |
| 179 | + | |
171 | 180 |
| |
172 | 181 |
| |
173 | 182 |
| |
174 | 183 |
| |
175 | 184 |
| |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
176 | 206 |
| |
177 | 207 |
| |
178 | 208 |
| |
|
0 commit comments
Comments
(0)