- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit82a4eda
committed
hio: Take number of prior relation extensions into account
The new relation extension logic, introduced in00d1e02, could lead toslowdowns in some scenarios. E.g., when loading narrow rows into a table usingCOPY, the caller of RelationGetBufferForTuple() will only request a smallnumber of pages. Without concurrency, we just extended using pwritev() in thatcase. However, if there is *some* concurrency, we switched between extendingby a small number of pages and a larger number of pages, depending on thenumber of waiters for the relation extension logic. However, somefilesystems, XFS in particular, do not perform well when switching betweenextending files using fallocate() and pwritev().To avoid that issue, remember the number of prior relation extensions inBulkInsertState and extend more aggressively if there were prior relationextensions. That not just avoids the aforementioned slowdown, but also leadsto noticeable performance gains in other situations, primarily due toextending more aggressively when there is no concurrency. I should have doneit this way from the get go.Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>Author: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/CAD21AoDvDmUQeJtZrau1ovnT_smN940=Kp6mszNGK3bq9yRN6g@mail.gmail.comBackpatch: 16-, where the new relation extension code was added1 parent94f9c08 commit82a4eda
3 files changed
+30
-3
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1776 | 1776 |
| |
1777 | 1777 |
| |
1778 | 1778 |
| |
| 1779 | + | |
1779 | 1780 |
| |
1780 | 1781 |
| |
1781 | 1782 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
283 | 283 |
| |
284 | 284 |
| |
285 | 285 |
| |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
286 | 304 |
| |
287 | 305 |
| |
288 | 306 |
| |
| |||
409 | 427 |
| |
410 | 428 |
| |
411 | 429 |
| |
| 430 | + | |
412 | 431 |
| |
413 | 432 |
| |
414 | 433 |
| |
|
Lines changed: 10 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
32 | 32 |
| |
33 | 33 |
| |
34 | 34 |
| |
35 |
| - | |
36 |
| - | |
37 |
| - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
38 | 40 |
| |
39 | 41 |
| |
40 | 42 |
| |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
41 | 47 |
| |
42 | 48 |
| |
43 | 49 |
| |
| 50 | + | |
44 | 51 |
| |
45 | 52 |
| |
46 | 53 |
| |
|
0 commit comments
Comments
(0)