Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vitYE-000srP-07 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 12:12:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vitYD-00Cufs-0M for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 12:12:37 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vitYC-00Cufk-2d for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 12:12:37 +0000 Received: from mail-oo1-xc29.google.com ([2607:f8b0:4864:20::c29]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vitYB-001tpj-0W for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 12:12:36 +0000 Received: by mail-oo1-xc29.google.com with SMTP id 006d021491bc7-661077c4d36so1200865eaf.0 for ; Thu, 22 Jan 2026 04:12:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769083953; cv=none; d=google.com; s=arc-20240605; b=VnqsVJmX157SJriy1LDXMKgsfu8os0QvtJMDIUxLwPnQrWdl8eypJZWQqYrcy/2O5y ZPhni3wLFp0tCq0nNZ/QMbCSE+EIhO5vzSIPXal+wZ/eewpCaCqQ/61zgq7R4lhU1ZBV aThVHtVCichGTJMG7h9N86CIGO31+0E8sCUiIWEN1BOvg/GKYsy0pgFnJLVWpZxpGkTH 2G4MaYzwKJhYs4xKkszo9x7qJXqSuqKUb4WH9mMBHsJMCa86AQJWmgnPAloK7t8y8B+b ubKSVk0hIrWrivnJh3LiUkJvvwvlpZp2I1KtA5Gg++9uE7XZxsLUoaDHlA3PqV137WMl iNaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=QFmlikwivuNDQPy1hErNcb8KYD8cUW3rKME18uxNoNI=; fh=6uuQXSVPMwih6MfBRIRFJGPQSXVh37hBS3Bzofm976E=; b=DH/FFKNPjs4+v5uQcK8t+vISphOyXHIP/OjPyiPo81G2xKV89TUxfUsw3BdrrLDvzC 89jGXmlQIu39p0GDj8COfq+WafpABmjJstbqNUF94RlCQ7vIuwLN1fO2pUF2j092beQ6 QyOXjLzEUztnYqdgPRekm542OdBqejm3v8t5I8o8ZD1pHhs5NYNQNQXRvRNbGkp8GNX3 xqNt39hCQHXz0hbJQU6C8anFcuXA4sUlF/zWjtwl8q6rHHwmEidEfWkAsFOcFxyEwcr/ ZpdGxHJj6SyUs1mfK+gzYg/1q49dU+rCqTYt/jTXne4XcKIb4GSk0zX0pqhDC6pZzfj6 fPtw==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769083953; x=1769688753; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=QFmlikwivuNDQPy1hErNcb8KYD8cUW3rKME18uxNoNI=; b=dTKazvuLof53m5BHXY/aK8I+gsCYG4Lw8CE76NDD/hsxKW9c9TeKqno/V5AKm6orIj 0lqSOgBKPQGEz6+HPd7efb/ZUZc0ZpAB1niSRboTg2pBhCsTIQUqsvfXOWjbu/grsijQ akPIoajo2Y1f4wJguh2FJA8zwzi4Wu1xh6k/Tm/64i4GwF9Trd3aM5/bS8HMa/DXB5Qv liYFu/wRignJG9EUjVXok1ehaTR0wJctBfcWkdlaglmAhdn/KKHcLpHjkJO3te61Ugvc u0dGei2jF9tNpcHFWRUroZ9KU6OcMe7Ka2Jr7dakbMwn4nDtV1F86g6hIU1LdLjJM0jJ C6Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769083953; x=1769688753; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=QFmlikwivuNDQPy1hErNcb8KYD8cUW3rKME18uxNoNI=; b=XVylec9UNmcmljNhLYC9OQY7h7sT6QgD/ThQVCjrqaiTrA6XByjnWGsZ+Rf1Rjccou ymCpt8yBrNweGeR1aQ2bxqTTbmjNEUyaxFnNne4liC0Q60O8/XgQ8tWQrgRvSF8ip6el cIjJohcYueBlPnXdFXbixqX+rTkVPH/5F2x6PUJOkXhBqFug8fuIMKxb3h+bwCrlRujQ 1Ju+AnYoK/kEl1tY2MN48fE7boGypJ1yX8nTNX0tNxYne47v1110tb6OzKLQQaVY22I7 f7pf/4LAZ9E3QH980vf1THsr+NS5/lNrUqgNaYj6GO9Sl9Kq1JuqUsyjOGPBA3mxUoBS +B7A== X-Forwarded-Encrypted: i=1; AJvYcCWixnO7KnZEDYU4UL1ejxLIdzL83Hu3CyNzyv/Oz//FTfu2UQFsfoeBCLqdzMzK1+oV/vI4WxcYOtVGUq4c@lists.postgresql.org X-Gm-Message-State: AOJu0YyVypbnAXhlreVibx5/x/F6ftHH0D++8OEh22UsjJOyxKciiEz0 VbPQQmeh0gWtM58nOuU9jerXq6jKQTf+Ueu8Vs+VCWSR8cZwVq4/GoFLdbl30Xd9uwSoMWH1/dd E0Ax3gLBvKqjsRZmakunA7a4L8obZUP8= X-Gm-Gg: AZuq6aLypoFkq2P4TDhu7OaLNFojZjFNoIBMTlwlZrSL6qmRAOqW0yPWaugAT0blOOL dju9v6/I+r9VWHsS8cOPa5u6vvNbxl/AGtxk6CHBkbIBrYT4XAHq9ujR8e5JvwFGhtb7FoJMcaB msYWST8vZHS//wFGN5YWUK1deTOgwJSDJPjSzCl4CicbhJnIWaxb5x45qojDGON/3kpLcr234g7 X6qYg9N+jZCqQ8jhXb+bHfEktbQl0+4BlsMYA/ND7OoqN0XDgJkDcUE7ixYQ+VVaP5pM1BXoVKo NzPduwt0FkK5TfbRlJ211xJ3/4B8K63QfgH6viMC X-Received: by 2002:a05:6820:1ca8:b0:662:bd09:3cd9 with SMTP id 006d021491bc7-662c1c22845mr1816901eaf.37.1769083952684; Thu, 22 Jan 2026 04:12:32 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Fujii Masao Date: Thu, 22 Jan 2026 21:12:18 +0900 X-Gm-Features: AZwV_QgOCnC-RWwvJms_Ff_7yHKVcrxbRINXMo7H8K0wlRkRGbL1_OVUYuoPLzg Message-ID: Subject: Re: Flush some statistics within running transactions To: Bertrand Drouvot Cc: Sami Imseih , Michael Paquier , pgsql-hackers@lists.postgresql.org, Zsolt Parragi Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Jan 22, 2026 at 4:43=E2=80=AFPM Bertrand Drouvot wrote: > > Hi, > > On Thu, Jan 22, 2026 at 10:56:48AM +0900, Fujii Masao wrote: > > On Thu, Jan 22, 2026 at 10:41=E2=80=AFAM Sami Imseih wrote: > > > > > > Sure, Bertrand mentioned early in the thread that the anytime flushes > > > could be made configurable. Perhaps that is a good idea where we can > > > default with something large like 10s intervals for anytime flushes, = but allow > > > the user to configure a more frequent flushes ( although I would thin= k > > > that 1 sec is the minimum we should allow ). > > > > +1 on adding an option to control the interval. With a fixed interval > > (for example, 1s), log_lock_waits messages could be emitted that freque= ntly, > > which may be annoying for some users. > > > > Of course, it would be even better if these periodic wakeups did not tr= igger > > log_lock_waits messages at all, though. > > pgstat_report_anytime_stat() is called with the force parameter set to fa= lse, > means that the flushes are done with nowait =3D true means that LWLockCon= ditionalAcquire() > is used. In that case, do you still see cases where log_lock_waits messag= es could > be triggered due to the new flush? I haven't read the patch in detail yet, but after applying patch 0001 and causing a lock wait (for example, using the steps below), I observed that log_lock_waits messages are emitted every second. [session 1] create table tbl as select id from generate_series(1, 10) id; begin; select * from tbl where id =3D 1 for update; [session 2] begin; select * from tbl where id =3D 1 for update; With this setup, the following messages were logged once per second: LOG: process 72199 still waiting for ShareLock on transaction 771 after 63034.119 ms DETAIL: Process holding the lock: 72190. Wait queue: 72199. Regards, --=20 Fujii Masao