Re: pg_stat_statements: Avoid holding excessive lock

2024-11-10 Thread Michael Paquier
On Fri, Nov 08, 2024 at 05:49:45PM +0800, wenhui qiu wrote: > Agree , It reduces the lock time , The new comment are short and concise, > It sounds good . Thanks for the double-check. Applied on HEAD. -- Michael signature.asc Description: PGP signature

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-08 Thread wenhui qiu
Hi Karina Liskevich > + /* > + * There is no need to hold entry->mutex when reading stats_since and > + * minmax_stats_since for (unlike counters) they are always written > + * while holding pgss->lock exclusively. We are holding pgss->lock > +

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-07 Thread Michael Paquier
On Thu, Nov 07, 2024 at 04:08:30PM +0300, Karina Litskevich wrote: > Thank you for your feedback and the shorter wording of the comment. > I used it in the new version of the patch. After a second look, sounds good to me. Let's wait a bit and see of others have comments or thoughts to share. -- M

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-07 Thread Karina Litskevich
On Thu, Nov 7, 2024 at 11:17 AM Michael Paquier wrote: > The comment could be simpler, say a "The spinlock is not required when > reading these two as they are always updated when holding pgss->lock > exclusively.". Or something like that. Thank you for your feedback and the shorter wording of t

Re: pg_stat_statements: Avoid holding excessive lock

2024-11-07 Thread Michael Paquier
On Tue, Nov 05, 2024 at 08:37:08PM +0300, Karina Litskevich wrote: > I suggest eliminating holding the excessive lock. See the attached patch. > This would also restore the consistency between the code and the comments > about entry's mutex spinlock usage. You are right. minmax_stats_since and st