forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit279628a
committed
Accelerate end-of-transaction dropping of relations
When relations are dropped, at end of transaction we need to remove thefiles and clean the buffer pool of buffers containing pages of thoserelations. Previously we would scan the buffer pool once per relationto clean up buffers. When there are many relations to drop, therepeated scans make this process slow; so we now instead pass a list ofrelations to drop and scan the pool once, checking each buffer againstthe passed list. When the number of relations is larger than athreshold (which as of this patch is being set to 20 relations) we sortthe array before starting, and bsearch the array; when it's smaller, wesimply scan the array linearly each time, because that's faster. Theexact optimal threshold value depends on many factors, but thedifference is not likely to be significant enough to justify making ituser-settable.This has been measured to be a significant win (a 15x win when dropping100,000 relations; an extreme case, but reportedly a real one).Author: Tomas Vondra, some tweaks by meReviewed by: Robert Haas, Shigeru Hanada, Andres Freund, Álvaro Herrera1 parent0b63291 commit279628a
5 files changed
+206
-14
lines changedLines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
312 | 312 |
| |
313 | 313 |
| |
314 | 314 |
| |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
315 | 319 |
| |
316 | 320 |
| |
317 | 321 |
| |
| |||
335 | 339 |
| |
336 | 340 |
| |
337 | 341 |
| |
338 |
| - | |
339 |
| - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
340 | 351 |
| |
341 | 352 |
| |
342 | 353 |
| |
343 | 354 |
| |
344 | 355 |
| |
345 | 356 |
| |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
346 | 368 |
| |
347 | 369 |
| |
348 | 370 |
| |
|
Lines changed: 99 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
62 | 62 |
| |
63 | 63 |
| |
64 | 64 |
| |
| 65 | + | |
65 | 66 |
| |
66 | 67 |
| |
67 | 68 |
| |
| |||
107 | 108 |
| |
108 | 109 |
| |
109 | 110 |
| |
| 111 | + | |
110 | 112 |
| |
111 | 113 |
| |
112 | 114 |
| |
| |||
2086 | 2088 |
| |
2087 | 2089 |
| |
2088 | 2090 |
| |
2089 |
| - | |
| 2091 | + | |
2090 | 2092 |
| |
2091 | 2093 |
| |
2092 |
| - | |
2093 |
| - | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
2094 | 2097 |
| |
2095 | 2098 |
| |
2096 | 2099 |
| |
2097 |
| - | |
| 2100 | + | |
2098 | 2101 |
| |
2099 |
| - | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
2100 | 2111 |
| |
2101 | 2112 |
| |
2102 |
| - | |
| 2113 | + | |
2103 | 2114 |
| |
2104 |
| - | |
2105 |
| - | |
| 2115 | + | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2106 | 2131 |
| |
2107 | 2132 |
| |
2108 | 2133 |
| |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
| 2140 | + | |
| 2141 | + | |
| 2142 | + | |
| 2143 | + | |
| 2144 | + | |
| 2145 | + | |
2109 | 2146 |
| |
2110 | 2147 |
| |
| 2148 | + | |
2111 | 2149 |
| |
2112 | 2150 |
| |
2113 | 2151 |
| |
2114 | 2152 |
| |
2115 | 2153 |
| |
2116 | 2154 |
| |
2117 |
| - | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
| 2161 | + | |
| 2162 | + | |
| 2163 | + | |
| 2164 | + | |
| 2165 | + | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
| 2170 | + | |
| 2171 | + | |
| 2172 | + | |
| 2173 | + | |
| 2174 | + | |
| 2175 | + | |
| 2176 | + | |
| 2177 | + | |
2118 | 2178 |
| |
2119 | 2179 |
| |
2120 | 2180 |
| |
2121 |
| - | |
| 2181 | + | |
2122 | 2182 |
| |
2123 | 2183 |
| |
2124 | 2184 |
| |
2125 | 2185 |
| |
| 2186 | + | |
| 2187 | + | |
2126 | 2188 |
| |
2127 | 2189 |
| |
2128 | 2190 |
| |
| |||
2953 | 3015 |
| |
2954 | 3016 |
| |
2955 | 3017 |
| |
| 3018 | + | |
| 3019 | + | |
| 3020 | + | |
| 3021 | + | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + |
Lines changed: 81 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
390 | 390 |
| |
391 | 391 |
| |
392 | 392 |
| |
393 |
| - | |
| 393 | + | |
394 | 394 |
| |
395 | 395 |
| |
396 | 396 |
| |
| |||
419 | 419 |
| |
420 | 420 |
| |
421 | 421 |
| |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
422 | 502 |
| |
423 | 503 |
| |
424 | 504 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
188 | 188 |
| |
189 | 189 |
| |
190 | 190 |
| |
191 |
| - | |
| 191 | + | |
192 | 192 |
| |
193 | 193 |
| |
194 | 194 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
85 | 85 |
| |
86 | 86 |
| |
87 | 87 |
| |
| 88 | + | |
88 | 89 |
| |
89 | 90 |
| |
90 | 91 |
| |
|
0 commit comments
Comments
(0)