Re: logical replication worker accesses catalogs in error context callback
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Zhihong Yu <zyu@yugabyte.com>, Masahiko Sawada <sawada.mshk@gmail.com>,
Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>,
Peter Eisentraut <peter_e@gmx.net>,
Petr Jelinek <petr@2ndquadrant.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: 2021-03-15T20:51:30Z
Lists: pgsql-hackers
Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> writes: > Thanks for pointing to the changes in the commit message. I corrected > them. Attaching v4 patch set, consider it for further review. I took a quick look at this. I'm quite worried about the potential performance cost of the v4-0001 patch (the one for fixing slot_store_error_callback). Previously, we didn't pay any noticeable cost for having the callback unless there actually was an error. As patched, we perform several catalog lookups per column per row, even in the non-error code path. That seems like it'd be a noticeable performance hit. Just to add insult to injury, it leaks memory. I propose a more radical but simpler solution: let's just not bother with including the type names in the context message. How much are they really buying? v4-0002 (for postgres_fdw's conversion_error_callback) has the same problems, although mitigated a bit by not needing to do any catalog lookups in the non-join case. For the join case, I wonder whether we could push the lookups back to plan setup time, so they don't need to be done over again for each row. (Not doing lookups at all doesn't seem attractive there; it'd render the context message nearly useless.) A different idea is to try to get the column names out of the query's rangetable instead of going to the catalogs. regards, tom lane
Commits
-
Avoid doing catalog lookups in postgres_fdw's conversion_error_callback.
- bee18616a650 13.4 landed
- bd2e68d0bf94 12.8 landed
- b23ac5aefae4 10.18 landed
- a9460dbf1577 11.13 landed
- 67f925bbd9de 9.6.23 landed
- c7b7311f6177 15.0 landed
- 86d4914210e9 14.0 landed
-
Don't try to print data type names in slot_store_error_callback().
- 63a952167092 14.0 landed
- feff6155734e 12.8 landed
- 7fc97752d566 13.4 landed
- 50371df266d4 15.0 landed
- 32d50b895217 11.13 landed
- 0b5089e8c979 10.18 landed
-
logical replication: fix OID type mapping mechanism
- 24c0a6c64976 11.0 cited
-
Improve sys/catcache performance.
- 141fd1b66ce6 11.0 cited
-
Logical replication
- 665d1fad99e7 10.0 cited