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 1uMxP7-008Csy-8B for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 23:20:17 +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 1uMxP5-000mHr-2y for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 23:20:15 +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 1uMxP4-000mHi-Ke for pgsql-general@lists.postgresql.org; Wed, 04 Jun 2025 23:20:15 +0000 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uMxP3-000Fac-1p for pgsql-general@postgresql.org; Wed, 04 Jun 2025 23:20:14 +0000 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-2e3e58edab5so186042fac.3 for ; Wed, 04 Jun 2025 16:20:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749079213; x=1749684013; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=h4IAG3QAaCOwZa2LxOTKaAMck+T0sOyMN4Qz22Kn/tM=; b=MJykjkrlmU7LtBWMEkleZfa3O9VaiVtHICIrhSEsBeWn68/qeZE2ERpmeH3km3erP0 zcfvTSARzLgwAFgUlaVjCnoGepYSKPuLzOmqC/xqAAHe2othj6Pb6Mpmayu2+9tX6QOZ dszFdi253EfZMTsp7TTPfOxMhzY2LKUZbwDadM9MDwGI7LiWCIHb3YExtqvz8yx3OjWe T5zfJlTOgolLfkQySnviD2LJtMAGKewp72yNgfz06dMzHka0sPJgzQMXTJrxXWxSIxK+ mR/L6LtctZRz3QUkdrX2aagSqkQLanVsEJnjBe5RdFJu+7hX2zkF9oy7Q+WlU9eSxhqZ PV+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749079213; x=1749684013; h=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=h4IAG3QAaCOwZa2LxOTKaAMck+T0sOyMN4Qz22Kn/tM=; b=Rweqx4yNdBGI/TygpGFfCvC6T1grOTUt2JbY2J9xAPxrI1KfNG38kpHWa228yreu45 S8Nr1iEv5q9CZSTRi63nGUdBcNrmEfSIxtDDRjetavXZ28PyGW3vURgcfcKqri509s/t dE2wgXZyQrKAkdZv+t0DBGCkGBHc1vwy71NlNgjmGWivXXbfn3zL+xn7uQFkzHI1wCac CnohmQFNfgzlJLBQzV7Wc5DuCAv/dCGFAMG0GTmbJspdS5OV0//R26SYwmfTYs6drwDm QIJOK7328yi8YY7YmhRwr6oNrpqnv+vD857ApGCrNt798WClln5Yn1hDJ8pVCjTyXBaS JA9w== X-Gm-Message-State: AOJu0Yz1BWO/bCpOasRXxCnP3PMtTtOj/pONLfFTJVfqh52oIzR3/CLw IjasV+bdcRJ44LY2UHz+C0GkIPsSwuUZgRsUug5x21/R6KynHav/tZYGRypwC880bjMlNzzxeC3 C180l7EjqmcqrN7RWTCR+xS1gKsaJG24= X-Gm-Gg: ASbGnctWb9rSGq4SadFGA2ZqShx7WFTTQlQMMt2xpTquEPjkPj+2dskoVO0G75cHYdI 8xvDG2ZSsCSSBb8RklkBGog+h+zFhGC9e6RQt2OeLe8SPpT+hYHb6vWOYWtDl18zgBqWvOprtlF eg3yCCijUF2GtifIMUUwLiTjVAEcOEsYE9iQ== X-Google-Smtp-Source: AGHT+IGYc2qjBQLddhxQgzk7Y/Kmmfd+LXHLcv5yzb0fV53nwxTB8NW4kh/9ax+dKt1b2+6f1zTPPUxGNRaWKqoSO1Y= X-Received: by 2002:a05:6870:1494:b0:29e:6f32:6d91 with SMTP id 586e51a60fabf-2e9bf5d6610mr3396566fac.33.1749079212652; Wed, 04 Jun 2025 16:20:12 -0700 (PDT) MIME-Version: 1.0 References: <006D484F-66AC-4734-A7E5-2EFBB6CEC1FA@gmail.com> <48926C17-302B-4C37-849F-E2092CADE9E0@gmail.com> In-Reply-To: <48926C17-302B-4C37-849F-E2092CADE9E0@gmail.com> From: Ron Johnson Date: Wed, 4 Jun 2025 19:20:01 -0400 X-Gm-Features: AX0GCFur_F39GatXdUNCqdlOi5QGzk57GuNN1kfhjnflXjzY9QIR4IDp0oS24qs Message-ID: Subject: Re: Sudden increase in n_dead_tup with no corresponding insert/update/delete To: Matthew Tice Cc: pgsql-general@postgresql.org Content-Type: multipart/alternative; boundary="000000000000277c8b0636c73d7b" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000277c8b0636c73d7b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Note also that 15.6 is about 18 months old. Upgrading really does only take a few minutes, if you download the binaries before installation. On Wed, Jun 4, 2025 at 2:37=E2=80=AFPM Matthew Tice wrot= e: > > > On Jun 3, 2025, at 6:23=E2=80=AFPM, David Rowley = wrote: > > > > On Wed, 4 Jun 2025 at 07:22, Matthew Tice wrote: > >> Tue 03 Jun 2025 07:13:11 PM UTC (every 1s) > >> n_dead_tup | 5038 > >> autoanalyze_count | 3078 > > > >> Tue 03 Jun 2025 07:13:12 PM UTC (every 1s) > >> n_dead_tup | 1290579 > >> autoanalyze_count | 3079 > > > >> I don't understand where this large increase is coming from when there > are no corresponding inserts, updates, or deletes (at the magnitude). Th= is > entire process repeats itself and, as mentioned, the same thing is > happening on other observed tables. > > > > I imagine it's from the auto-analyze that ran. Analyze will try to > > estimate the live and dead rows, but since analyze only samples some > > blocks, it may come up with something that's not too accurate if the > > blocks it happened to sample don't contain similar percentages of dead > > rows than the entire table. > > > > See [1]. > > > > David > > > > [1] > https://github.com/postgres/postgres/blob/REL_15_STABLE/src/backend/comma= nds/analyze.c#L1318 > > Thanks, David. > > This table is relatively large (1.6B records, 1.5TB, 38 columns). The > `default_statistics_target` is set to 300 - so I think that 90000 may not > be enough to gather accurate statistics. > > --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --000000000000277c8b0636c73d7b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Note also that 15.6 is about 18 months old.=C2=A0 Upgradin= g really does only take a few minutes, if you download the binaries before = installation.

On Wed, Jun 4, 2025 at 2:37=E2=80=AFPM M= atthew Tice <mjtice@gmail.com>= ; wrote:

> On Jun 3, 2025, at 6:23=E2=80=AFPM, David Rowley <dgrowleyml@gmail.com> wrote= :
>
> On Wed, 4 Jun 2025 at 07:22, Matthew Tice <mjtice@gmail.com> wrote:
>> Tue 03 Jun 2025 07:13:11 PM UTC (every 1s)
>> n_dead_tup=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 5038
>> autoanalyze_count=C2=A0 =C2=A0| 3078
>
>> Tue 03 Jun 2025 07:13:12 PM UTC (every 1s)
>> n_dead_tup=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | 1290579
>> autoanalyze_count=C2=A0 =C2=A0| 3079
>
>> I don't understand where this large increase is coming from wh= en there are no corresponding inserts, updates, or deletes (at the magnitud= e).=C2=A0 This entire process repeats itself and, as mentioned, the same th= ing is happening on other observed tables.
>
> I imagine it's from the auto-analyze that ran. Analyze will try to=
> estimate the live and dead rows, but since analyze only samples some > blocks, it may come up with something that's not too accurate if t= he
> blocks it happened to sample don't contain similar percentages of = dead
> rows than the entire table.
>
> See [1].
>
> David
>
> [1] https://github.com/postgres/postgres/blob/REL_15_STABLE/src/backend/comman= ds/analyze.c#L1318

Thanks, David.=C2=A0

This table is relatively large (1.6B records, 1.5TB, 38 columns).=C2=A0 The= `default_statistics_target` is set to 300 - so I think that 90000 may not = be enough to gather accurate statistics.



--
Death to <Redacted>, and butter sauce.Don't boil me, I'm still alive.
<Redacted> lobs= ter!
--000000000000277c8b0636c73d7b--