forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitc98763b
committed
Avoid spurious waits in concurrent indexing
In the various waiting phases of CREATE INDEX CONCURRENTLY (CIC) andREINDEX CONCURRENTLY (RC), we wait for other processes to release theirsnapshots; this is necessary in general for correctness. However,processes doing CIC in other tables cannot possibly affect CIC or RCdone in "this" table, so we don't need to wait for those. This commitadds a flag in MyProc->statusFlags to indicate that the current processis doing CIC, so that other processes doing CIC or RC can ignore it whenwaiting.Note that this logic is only valid if the index does not access othertables. For simplicity we avoid setting the flag if the index has acolumn that's an expression, or has a WHERE predicate. (It is possibleto have expressional or partial indexes that do not access other tables,but figuring that out would require more work.)This flag can potentially also be used by processes doing REINDEXCONCURRENTLY to be skipped; and by VACUUM to ignore processes in CIC orRC for the purposes of computing an Xmin. That's left for futurecommits.Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Author: Dimitry Dolgov <9erthalion6@gmail.com>Reviewed-by: Michael Paquier <michael@paquier.xyz>Discussion:https://postgr.es/m/20200810233815.GA18970@alvherre.pgsql1 parent314fb9b commitc98763b
2 files changed
+64
-4
lines changedLines changed: 60 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
93 | 93 |
| |
94 | 94 |
| |
95 | 95 |
| |
| 96 | + | |
96 | 97 |
| |
97 | 98 |
| |
98 | 99 |
| |
| |||
384 | 385 |
| |
385 | 386 |
| |
386 | 387 |
| |
387 |
| - | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
388 | 392 |
| |
389 | 393 |
| |
390 | 394 |
| |
| |||
405 | 409 |
| |
406 | 410 |
| |
407 | 411 |
| |
408 |
| - | |
| 412 | + | |
| 413 | + | |
409 | 414 |
| |
410 | 415 |
| |
411 | 416 |
| |
| |||
425 | 430 |
| |
426 | 431 |
| |
427 | 432 |
| |
428 |
| - | |
| 433 | + | |
| 434 | + | |
429 | 435 |
| |
430 | 436 |
| |
431 | 437 |
| |
| |||
518 | 524 |
| |
519 | 525 |
| |
520 | 526 |
| |
| 527 | + | |
521 | 528 |
| |
522 | 529 |
| |
523 | 530 |
| |
| |||
1044 | 1051 |
| |
1045 | 1052 |
| |
1046 | 1053 |
| |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
1047 | 1058 |
| |
1048 | 1059 |
| |
1049 | 1060 |
| |
| |||
1430 | 1441 |
| |
1431 | 1442 |
| |
1432 | 1443 |
| |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1433 | 1448 |
| |
1434 | 1449 |
| |
1435 | 1450 |
| |
| |||
1489 | 1504 |
| |
1490 | 1505 |
| |
1491 | 1506 |
| |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
1492 | 1511 |
| |
1493 | 1512 |
| |
1494 | 1513 |
| |
| |||
1545 | 1564 |
| |
1546 | 1565 |
| |
1547 | 1566 |
| |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
1548 | 1571 |
| |
1549 | 1572 |
| |
1550 | 1573 |
| |
| |||
3896 | 3919 |
| |
3897 | 3920 |
| |
3898 | 3921 |
| |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
| 3929 | + | |
| 3930 | + | |
| 3931 | + | |
| 3932 | + | |
| 3933 | + | |
| 3934 | + | |
| 3935 | + | |
| 3936 | + | |
| 3937 | + | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
| 3941 | + | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
| 3945 | + | |
| 3946 | + | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + | |
| 3953 | + | |
| 3954 | + | |
| 3955 | + |
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
53 | 53 |
| |
54 | 54 |
| |
55 | 55 |
| |
| 56 | + | |
| 57 | + | |
| 58 | + | |
56 | 59 |
| |
57 | 60 |
| |
58 | 61 |
| |
59 | 62 |
| |
60 | 63 |
| |
61 | 64 |
| |
62 |
| - | |
| 65 | + | |
63 | 66 |
| |
64 | 67 |
| |
65 | 68 |
| |
|
0 commit comments
Comments
(0)