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 1uMbvE-00GUq6-Ah for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 00:24:00 +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 1uMbvC-005zhH-3N for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 00:23:58 +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 1uMbvB-005zh9-NF for pgsql-general@lists.postgresql.org; Wed, 04 Jun 2025 00:23:58 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uMbvA-0005P6-1L for pgsql-general@postgresql.org; Wed, 04 Jun 2025 00:23:58 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-32a81344ae9so66988031fa.0 for ; Tue, 03 Jun 2025 17:23:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1748996634; x=1749601434; 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=kpbaUzkxVabfW/XltPHbWG69BSJ6JMGHViev0xDh8JI=; b=ZqXaCajWYNQycNznX9L3W9F/qOTzHgdDFBFNhZYieHH/BvtkVALm3Hy5h7aXyODGmo qwN17zD3c4rwpUisMn0qcqSGgZJ036FQYx67ohxb/5h+9xAx8m9ZewDIkAp5o6cs5xKK 9ZXM1AyMRD/0PF8BdiVqqfqaJUQOUSwB8gBaJFuT71inNgQLPecUiMiJJ0SIaVjPV777 8iOdMBHPnRLyZf/G2Feb9OlcDHPyzfHiCUjefwvR5ndDGjmhacugGkI0LLGjUcbUQqYQ nuE9WyFSCLB8pP5+ho0LAJvKcJZnaqaNxHSmoUso6T8LEQIezQ/ZpJ/KJqwwT/FDzrBL x6sw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748996634; x=1749601434; 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=kpbaUzkxVabfW/XltPHbWG69BSJ6JMGHViev0xDh8JI=; b=BtLUHyWC55Jd34S5Q+733Xje9722/er93xxuD2STe86Ej65bRl3zT2TnQZMHycGqOl Q7dlXjRzhesEShyy3w3S8i4sWHYIZFg6ezeGa9g2flQ7rWVHpsZXhE/Vtx51SgpjQEAC gNVbZrp+kTtAe7pqC7P/7ih+eYMIShoqnyC6B8nYGArcWJOEc50vxmmX6YaNH4M22+bV zHlRrt8d9NBE0Np4hUP48hdJrDIEyFFlqBlq8ekHsjU+fHTcvAbLdpE2Z1inEQWSQedB ivbvw0DwkbIiyl3ZJC+mDr81LkwYpYuVWcHk3FxOtEL7BxpY025TJao2YqRpTzLJIAFd lXIA== X-Gm-Message-State: AOJu0YxXDuUOYr3XOZICqd0YKe7x8eJHlWgwnxeWZn3yx/Stz2PSgd1R ZeiQRC2FwV9soiq5+MZCIRPrYsU3yhe+sQ9TVs3pIAVl+kYteXGttyQ+GpfUmsnWNcu8st4TkMw z+YyuIb7/5uLjZr/q9FMM50Itrt8FgXk= X-Gm-Gg: ASbGncubsCqnKsISfsUinAQhcAYbY3QbGASonRhoepVNNbVxdvljTzi5ofl1WbGVBeI 4eKcDgFmunH56MFYoNn+tz6zqgopaAZGWtUuvAueFGBxVJkfsbeShVvgWfsLzecpHVex5f4PeQ6 wD4xqzOFCQFqRMn9SiXdd9cQYACL+P4J6YWr/mxrj+NcyV8TuR0Zd3I/U7gaJxWtLWQcqHFHl8v XLlAw== X-Google-Smtp-Source: AGHT+IGxBAS9FSB2Eu85ypTxGZO096v680xY3n+bXM62uG7Etx/Hz2azbVglcGJRwvswRYS2PSxW7J/aqDy5hLmEDHc= X-Received: by 2002:a2e:ae08:0:b0:32a:6df2:6e00 with SMTP id 38308e7fff4ca-32ac79f3f55mr947231fa.40.1748996634046; Tue, 03 Jun 2025 17:23:54 -0700 (PDT) MIME-Version: 1.0 References: <006D484F-66AC-4734-A7E5-2EFBB6CEC1FA@gmail.com> In-Reply-To: <006D484F-66AC-4734-A7E5-2EFBB6CEC1FA@gmail.com> From: David Rowley Date: Wed, 4 Jun 2025 12:23:40 +1200 X-Gm-Features: AX0GCFsafGqf0bvtRYDZ_rPVY3Gjrp99q9PWwETzhHxW_ytE36TzqgihkrvdkYU 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: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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). This 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/commands/analyze.c#L1318