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.94.2) (envelope-from ) id 1sMhWX-003xyk-HB for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jun 2024 05:18:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1sMhWV-008Iw8-KI for pgsql-hackers@arkaria.postgresql.org; Thu, 27 Jun 2024 05:18:19 +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.94.2) (envelope-from ) id 1sMhWV-008Ivz-AO for pgsql-hackers@lists.postgresql.org; Thu, 27 Jun 2024 05:18:19 +0000 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sMhWS-003luD-F2 for pgsql-hackers@lists.postgresql.org; Thu, 27 Jun 2024 05:18:18 +0000 Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-52ce17f6835so608054e87.1 for ; Wed, 26 Jun 2024 22:18:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719465495; x=1720070295; 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=OdpRMOAWU9+6VjobeYqScDj0fcQijNBCBSSWaN2ctXs=; b=DmJvvXfMCrFEtfeL/sdbFzwlW3TiEnwYKl3Rjt1b1hcX1vm1RUF6ieXoH2Zef9bqm9 gFaU/WNYBTwXxSx33YBSWGm18wxcXT9mFb/ecbIBcepB6O4+UOyacd60Hq7RZDQ5K6Qk cCt7jeZ/TE60O2ZfUHMUlmkq0HroMqhYe+x3e9VKCjvWsSgu4l5MOGmehseZhdsgy2v0 TAZxyMaZ+E2QCNCvzPWNrihizZSSqfE3uXyKZzpQO0/tKTHXvafk5nBxXOUtBDEwPUwr s8x+7nzrNcwDsgJLeN/OukM82t+PcXM4JNCIekeQbC4LpCRuq39u+QY6CATzERjR2ZF9 ejkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719465495; x=1720070295; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OdpRMOAWU9+6VjobeYqScDj0fcQijNBCBSSWaN2ctXs=; b=FFfVeWLRzKJPocCsXRJiTkYfC9eyaTA9f/0XL++yg9PAji4XaWX/Fsi0/dcDyNs0TE xMqPnbFQNRpg2i94mhAixvtl+cBOaMSKs/sG4FlDJRPWKRv6xH9eMkTHv1ma6kx7VMtl 7GIrGPANHhSIjQRgkMVC3wFqMbJVNvI1PraDzpSdER6isAe32/cEnI7XHiNmPAI+wBQF l9oS+OIo1tBNhX+oEe+s6xh4C/RG6eG4jskl7CepmFjNZiRu+rAygU41tioIzjdgvmr2 DR6/eTz4dZv1xmRJS12L3PKiQdqIVE+ojYyu+D+6YbqOP5sJSjfM7Gx1xhI68yV1TpQ3 wnqw== X-Gm-Message-State: AOJu0YzKBEsOelQ732/KI77mWTgT1eid55rnbcKIGgrB8mc47vw89N3c 8MSolkqT3rpzGchri3AVpuYuFG9eCD+3y+fPXKEmu4KF7zZQLncbnQP06euPyfczZAm++uE0bAE Z7o2vtisL74KpEuewHoEEq+RJdqw= X-Google-Smtp-Source: AGHT+IFiviO1eax0PqlKlCoUThoIFnpxmWjmWd1TeMykElYIJ6CIR+AbJBFoe23dZYZkxfkTEzRlNCEy1Hs4akt6tmU= X-Received: by 2002:a05:6512:2110:b0:52c:dae5:af2f with SMTP id 2adb3069b0e04-52cdea619demr7168641e87.0.1719465495165; Wed, 26 Jun 2024 22:18:15 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Masahiko Sawada Date: Thu, 27 Jun 2024 14:17:38 +0900 Message-ID: Subject: Re: Track the amount of time waiting due to cost_delay To: Bertrand Drouvot Cc: pgsql-hackers@lists.postgresql.org, Robert Haas 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 Mon, Jun 24, 2024 at 7:50=E2=80=AFPM Bertrand Drouvot wrote: > > Hi, > > On Sat, Jun 22, 2024 at 12:48:33PM +0000, Bertrand Drouvot wrote: > > 1. vacuuming indexes time has been longer on master because with v2, th= e leader > > has been interrupted 342605 times while waiting, then making v2 "faster= ". > > > > 2. the leader being interrupted while waiting is also already happening= on master > > due to the pgstat_progress_parallel_incr_param() calls in > > parallel_vacuum_process_one_index() (that have been added in > > 46ebdfe164). It has been the case "only" 36 times during my test case. > > > > I think that 2. is less of a concern but I think that 1. is something t= hat needs > > to be addressed because the leader process is not honouring its cost de= lay wait > > time in a noticeable way (at least during my test case). > > > > I did not think of a proposal yet, just sharing my investigation as to = why > > v2 has been faster than master during the vacuuming indexes phase. Thank you for the benchmarking and analyzing the results! I agree with your analysis and was surprised by the fact that the more times workers go to sleep, the more times the leader wakes up. > > I think that a reasonable approach is to make the reporting from the para= llel > workers to the leader less aggressive (means occur less frequently). > > Please find attached v3, that: > > - ensures that there is at least 1 second between 2 reports, per parallel= worker, > to the leader. > > - ensures that the reported delayed time is still correct (keep track of = the > delayed time between 2 reports). > > - does not add any extra pg_clock_gettime_ns() calls (as compare to v2). > Sounds good to me. I think it's better to keep the logic for throttling the reporting the delay message simple. It's an important consideration but executing parallel vacuum with delays would be less likely to be used in practice. Regards, --=20 Masahiko Sawada Amazon Web Services: https://aws.amazon.com