On Wed, Jun 14, 2023 at 02:08:03PM +0300, Aleksander Alekseev wrote: > > Unfortunately I'm not familiar with the problem in respect of naptime > Julien is referring to. If you know what this problem is and how to > fix it, go for it. I'll review and test the code then. I can write the > part of the patch that fixes the part regarding dynamic workers if > necessary.
Oh, sorry I thought it was somewhat evident. The naptime GUC description says: > Duration between each check (in seconds). and the associated code does a single WaitLatch(..., WL_LATCH_SET | WL_TIMEOUT, ...) So unless I'm missing something nothing prevents the check being run way more often than expected if the latch keeps being set. Similarly, my understanding of "duration between checks" is that a naptime of 1 min means that the check should be run a minute apart, assuming it's possible. As is, the checks are run naptime + query execution time apart, which doesn't seem right. Obviously there's isn't much you can do if the query execution lasts for more than naptime, apart from detecting it and raising a warning to let users know that their configuration isn't adequate (or that there's some other problem like some lock contention or something), similarly to e.g. checkpoint_warning. Note I haven't looked closely at this module otherwise, so I can't say if there are some other problems around.