pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid
4+ messages / 1 participants
[nested] [flat]

* pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid
@ 2017-05-12 22:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2017-05-12 22:17 UTC (permalink / raw)
  To: 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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/50ee1c7462d796639eef6c24b1797df8c4d6c098

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid
@ 2017-05-12 22:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2017-05-12 22:17 UTC (permalink / raw)
  To: 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_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/b7a98b14c35390eff80bb094ae41d62f03916920

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid
@ 2017-05-12 22:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2017-05-12 22:17 UTC (permalink / raw)
  To: 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_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3569a9a73e6aa7d5b813115cc0a28969592bdc1f

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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid
@ 2017-05-12 22:17 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

From: Tom Lane @ 2017-05-12 22:17 UTC (permalink / raw)
  To: 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(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2017-05-12 22:17 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-05-12 22:17 pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid Tom Lane <tgl@sss.pgh.pa.us>
2017-05-12 22:17 pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid Tom Lane <tgl@sss.pgh.pa.us>
2017-05-12 22:17 pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid Tom Lane <tgl@sss.pgh.pa.us>
2017-05-12 22:17 pgsql: Avoid searching for the target catcache in CatalogCacheIdInvalid Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox