On Thu, Apr 08, 2021 at 02:52:26PM +0530, Amit Kapila wrote:
> 
> Yeah, we do pass instrumentation flags from leader to worker but not
> the one allocated via pg_stat_staments (pgss_ExecutorStart {...
> queryDesc->totaltime ...}.

Ah indeed, I now remember that problem that I had to deal with in some
extensions [1].  For the record this was initially raised by Tomas in [2], but
unfortunately that thread got forgotten and probably all third-party extensions
ended up allocating some shmem for their need.

> However, I guess prior to this patch those
> were anyway not allocated separately because queryid was not passed to
> workers. So, I think you are right it shouldn't change the previous
> behavior.

I think that previously parallel workers always added the required
instrumentation if pg_stat_statements is loaded, but InstrEndLoop() wasn't
called by pgss itself so I'm not sure what happens in that case.

> I am not completely sure but it seems we were not accumulating the
> instrumentation info by workers required by pg_stat_statements neither
> before this patch nor after but I might be missing something.

Same here.  I'll try to dig to get an answer, but it seems to me that it's an
old bug and not really a new one.  It would probably still make sense to add an
open item for this in pg14 as it's evidently more broken that before.

[1]: https://github.com/powa-team/pg_qualstats/issues/9
[2]: 
https://www.postgresql.org/message-id/3f62f24e-51b3-175c-9222-95f25fd2a...@2ndquadrant.com


Reply via email to