[COMMITTERS] pgsql: Avoid searching for the target catcache inCatalogCacheIdInvalid

Поиск
Список
Период
Сортировка
От Tom Lane
Тема [COMMITTERS] pgsql: Avoid searching for the target catcache inCatalogCacheIdInvalid
Дата
Msg-id E1d9Isi-0007wr-1q@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Avoid searching for the target catcache in CatalogCacheIdInvalidate.

A test case provided by Mathieu Fenniak shows that the initial search for
the target catcache in CatalogCacheIdInvalidate consumes a very significant
amount of overhead in cases where cache invalidation is triggered but has
little useful work to do.  There is no good reason for that search to exist
at all, as the index array maintained by syscache.c allows direct lookup of
the 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 reduces
the runtime of Mathieu's example by 2X.  We can hope that it offers some
useful benefit in other cases too, although usually cache invalidation
overhead is not such a striking fraction of the total runtime.

Back-patch to 9.4 where logical decoding was introduced.  It might be
worth going further back, but presently the only case we know of where
cache 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 always
documented CatalogCacheIdInvalidate as a private function, so I would
have little sympathy for an external module calling it directly.  So
backpatching should be fine.)

Discussion: https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com

Branch
------
REL9_4_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/64417f8d35cf43c2bb0a38028b40338a0036e3f9

Modified Files
--------------
src/backend/utils/cache/catcache.c | 92 ++++++++++++++++----------------------
src/backend/utils/cache/inval.c    |  2 +-
src/backend/utils/cache/syscache.c | 21 +++++++++
src/include/utils/catcache.h       |  2 +-
src/include/utils/syscache.h       |  2 +
5 files changed, 64 insertions(+), 55 deletions(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: [COMMITTERS] pgsql: Fix dependencies for extended statistics objects.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: [COMMITTERS] pgsql: getObjectDescription: support extended statistics