forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit50ee1c7
committed
Avoid searching for the target catcache in CatalogCacheIdInvalidate.
A test case provided by Mathieu Fenniak shows that the initial search forthe target catcache in CatalogCacheIdInvalidate consumes a very significantamount of overhead in cases where cache invalidation is triggered but haslittle useful work to do. There is no good reason for that search to existat all, as the index array maintained by syscache.c allows direct lookup ofthe catcache from its ID. We just need a frontend function in syscache.c,matching the division of labor for most other cache-accessing operations.While there's more that can be done in this area, this patch alone reducesthe runtime of Mathieu's example by 2X. We can hope that it offers someuseful benefit in other cases too, although usually cache invalidationoverhead is not such a striking fraction of the total runtime.Back-patch to 9.4 where logical decoding was introduced. It might beworth going further back, but presently the only case we know of wherecache invalidation is really a significant burden is in logical decoding.Also, older branches have fewer catcaches, reducing the possible benefit.(Note: although this nominally changes catcache's API, we have alwaysdocumented CatalogCacheIdInvalidate as a private function, so I wouldhave little sympathy for an external module calling it directly. Sobackpatching should be fine.)Discussion:https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com1 parent928c4de commit50ee1c7
File tree
5 files changed
+64
-55
lines changed- src
- backend/utils/cache
- include/utils
5 files changed
+64
-55
lines changedLines changed: 39 additions & 53 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
422 | 422 |
| |
423 | 423 |
| |
424 | 424 |
| |
425 |
| - | |
| 425 | + | |
426 | 426 |
| |
427 | 427 |
| |
428 | 428 |
| |
| |||
440 | 440 |
| |
441 | 441 |
| |
442 | 442 |
| |
443 |
| - | |
| 443 | + | |
444 | 444 |
| |
445 |
| - | |
| 445 | + | |
| 446 | + | |
446 | 447 |
| |
447 |
| - | |
| 448 | + | |
448 | 449 |
| |
449 | 450 |
| |
450 |
| - | |
| 451 | + | |
| 452 | + | |
451 | 453 |
| |
452 |
| - | |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 | 454 |
| |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
466 | 462 |
| |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 |
| - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
474 | 468 |
| |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
480 | 476 |
| |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 |
| - | |
485 |
| - | |
| 477 | + | |
486 | 478 |
| |
487 |
| - | |
488 |
| - | |
489 |
| - | |
| 479 | + | |
| 480 | + | |
490 | 481 |
| |
491 |
| - | |
492 |
| - | |
493 |
| - | |
494 |
| - | |
495 |
| - | |
496 |
| - | |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 |
| - | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
501 | 489 |
| |
502 |
| - | |
| 490 | + | |
503 | 491 |
| |
504 |
| - | |
505 |
| - | |
| 492 | + | |
506 | 493 |
| |
507 |
| - | |
508 | 494 |
| |
509 | 495 |
| |
510 | 496 |
| |
| |||
1823 | 1809 |
| |
1824 | 1810 |
| |
1825 | 1811 |
| |
1826 |
| - | |
| 1812 | + | |
1827 | 1813 |
| |
1828 | 1814 |
| |
1829 | 1815 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
552 | 552 |
| |
553 | 553 |
| |
554 | 554 |
| |
555 |
| - | |
| 555 | + | |
556 | 556 |
| |
557 | 557 |
| |
558 | 558 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1338 | 1338 |
| |
1339 | 1339 |
| |
1340 | 1340 |
| |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
1341 | 1362 |
| |
1342 | 1363 |
| |
1343 | 1364 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
190 | 190 |
| |
191 | 191 |
| |
192 | 192 |
| |
193 |
| - | |
| 193 | + | |
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
| 143 | + | |
| 144 | + | |
143 | 145 |
| |
144 | 146 |
| |
145 | 147 |
| |
|
0 commit comments
Comments
(0)