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 1uUla2-008Dqz-6v for pgsql-performance@arkaria.postgresql.org; Thu, 26 Jun 2025 12:19:50 +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 1uUla0-00C5vP-Aw for pgsql-performance@arkaria.postgresql.org; Thu, 26 Jun 2025 12:19:48 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uUla0-00C5vD-17 for pgsql-performance@lists.postgresql.org; Thu, 26 Jun 2025 12:19:48 +0000 Received: from mail-ed1-x534.google.com ([2a00:1450:4864:20::534]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uUlZy-0046KD-1a for pgsql-performance@lists.postgresql.org; Thu, 26 Jun 2025 12:19:47 +0000 Received: by mail-ed1-x534.google.com with SMTP id 4fb4d7f45d1cf-6099d89a19cso1741913a12.2 for ; Thu, 26 Jun 2025 05:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750940385; x=1751545185; 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=NLf5jPzEE1H7yQjJcJ2GdD07w3kbJ4dZ5dZAAcWcwVI=; b=Efnkg4MERsqzJ3ymddXXAfIzpbEKIBK2znvQnFC0K2cNjvJtxfCJZiYy35f+vi/bAe wpswvJTkicy17tC/rNfRfUI2B7Jc4EsEhOdI5XYXtZsdf+aHBIaT4kV6zQhjX1sO8PE0 JPNovJ3DKpZBK6Fq4Nf1CyUNX9cVf/o/gFmKgUbIfySkM6SIo+xizUeyHGLc/sQFi+tH sNUJZ7cH30MkXyngPG2HYBc0o+yo4qMJVs4qj63lr33BIb33X00Y4RM8G5f/yj+Teina JZgDdZV5Yr5do5PxS+X+BOROb7rM/mRpbxLmVpUmnSzI/iSKU3ZGfUZouxFm241rWfCA IXhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750940385; x=1751545185; 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=NLf5jPzEE1H7yQjJcJ2GdD07w3kbJ4dZ5dZAAcWcwVI=; b=gK7K8lzcz9mst9l0DIbtDEgVXCb442s7fNDZ07n5jDZh3JLdRyPxsfQwOC0OdzPE8J 99pAt6hmKubQRuxWOXZBdR57dfsuJGcKitDBUSNDGCCmhop9ttAJnxkdws8OD8OQC2se SZ7RiIkDoEvQrKkIRAfPKAm7V4KL/5XKqu3ItXaf4HnTN+lrHP3iXJChBi9gLXdAnvW+ 1KiPMncdnFf4gZ1xvLR9/Z5o0sWXdCvN+LDnVEvB1kC3LS0T1kJWBrVGorTnG8vngfxJ ethAD8+/F9wwZ6GTzOtOLuEDNMzF/zNVF5h3Q7EMEwTTXYV7rLRNMvtkLq08mtb5HW0c KgcA== X-Forwarded-Encrypted: i=1; AJvYcCWZNa2W2lOeOTL4Z4//DVr4jG0Bqg1woKpTXH3V0V5/Gji1to00xaaVj+aTd9e6dgs63RsgCD0OA7PWYtwPRD5mow==@lists.postgresql.org X-Gm-Message-State: AOJu0Yxq4N+7hAUpyVaeTBvezSnYjIYnznSw2a/XfaJtsRi1sogtSuXh 5ki6bsUWmoxY8NE0BFXQ5s//J+Q4IEPBFbSWfZC98MLdimfErv7g4PIyTa4vwukYji6UOPgy/CQ 1oUwtPHuXEXa/Q5KEK7YeDUAo3ZDkfLs= X-Gm-Gg: ASbGncuCh7OKwg4/kygqZZ6z/r71J2yatiOvrY7n5gLOHFVq7ODwuWkESeK7x/JQvIQ Lgh7VA/yWNfZhr9tworm1O8stxWDLky+OVqWjvPDQu1VRgDQm0UP74OhPdIu0KTVarnfRF8tzbR nB/egDuliIoQ9CY65UJHS4kUCFe+TdYUTF5YiIJW5UAs8= X-Google-Smtp-Source: AGHT+IEh7axuh8iSgKJ0PPpAhfyYXpo77fxpyoEdWxbnq128DNiXDuTQ7sjZxS7e4M+WHjEajyDU3GeEChMsm31WCFg= X-Received: by 2002:a17:907:d06:b0:ae0:3267:3374 with SMTP id a640c23a62f3a-ae0bed8d48fmr633300366b.34.1750940384625; Thu, 26 Jun 2025 05:19:44 -0700 (PDT) MIME-Version: 1.0 References: <66879d8bd44148f2ef1dcde1eff056e6c671306e.camel@cybertec.at> In-Reply-To: From: Robert Haas Date: Thu, 26 Jun 2025 08:19:33 -0400 X-Gm-Features: Ac12FXxMhy4UvhxrEEmRdmvAOxXqc4NoJwg28uFTgOThGquJXlm6Ut6h970EgrA Message-ID: Subject: Re: many sessions waiting DataFileRead and extend To: James Pang Cc: Frits Hoogland , Laurenz Albe , pgsql-performance@lists.postgresql.org 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, Jun 26, 2025 at 2:48=E2=80=AFAM James Pang = wrote: > we faced this issue 3 times this week, each time last only 2 seconds, = so not easy to run perf in peak business time to capture that, anyway, I wi= ll try. before that, I want to understand if "os page cache" or "pg buffer = cache" can contribute to the wait_event time "extend" and "DataFileRead", o= r bgwriter ,checkpoint flushing data to disk can impact that too ? we enab= le bgwriter , and we see checkpointer get scheduled by "wal" during the tim= e, so I just increased max_wal_size to make checkpoint scheduled in longer = time. To be honest, given the additional information that this only lasted 2 seconds, this doesn't sound terribly abnormal to me. My guess would be that a bunch of processes all tried to insert into the same relation at the time, so PostgreSQL had to make it bigger, and the OS couldn't extend the file quite quickly enough. I don't want to make it sound like there's absolutely no problem here: PostgreSQL's relation extension logic isn't as performant as we'd like it to be, and there have been several attempts to fix it over the years. I don't know if the last attempt was later than PG14, so you might have more success on a newer version, but I'm also not really sure if the limitations of the implementation are your main problem here. If I were troubleshooting this, I'd try to capture a snapshot of what queries were running at the moment the problem happens. If, for example, all the sessions suddenly decide to insert into the same table at the same time, it might be good to think about whether there's a way to avoid that. --=20 Robert Haas EDB: http://www.enterprisedb.com