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 1uMszn-006I3d-Na for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 18:37:51 +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 1uMszl-00FQHJ-IY for pgsql-general@arkaria.postgresql.org; Wed, 04 Jun 2025 18:37:50 +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 1uMszl-00FQHA-7o for pgsql-general@lists.postgresql.org; Wed, 04 Jun 2025 18:37:49 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uMszj-000DKI-2u for pgsql-general@postgresql.org; Wed, 04 Jun 2025 18:37:48 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-3db6ddcef4eso1482195ab.2 for ; Wed, 04 Jun 2025 11:37:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749062266; x=1749667066; darn=postgresql.org; h=message-id:references:cc:in-reply-to:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=2D+uVPcK+jW7yjItYE6CssAJKv1xvP6deAZoMsx8S+4=; b=LYhL92l3vteQ11dYyXvlgPH1L7RUCpYWHUZsSmc40gz1GhfSDMwoXiE8IR4s6Io1Db /2YopYAKBrVcCt3TNh9eRwHnQAwvvFwl8BVWQ+UPKSGz7EytuOplX5XUSPpe2dnG0HHE fX8ldsBB1iblgQND3ES9RZwcW9N9oTcOLLCtaq55Olxxy5KD3zv/dL5Jm3vuGpbkuuGW vHm1o5acz7yqmE3y8bYpCMlsxa4obuOdYEhQAPIRXErQfhx9gBGk1ygiOYYzHxt9/BOl /unLriOBzRP+aFj67HqqXB8dYOeBdVg7R94L+eLyeLsQv5w8TzPbK77Q+OMKAzRixHTX XX+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749062266; x=1749667066; h=message-id:references:cc:in-reply-to:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2D+uVPcK+jW7yjItYE6CssAJKv1xvP6deAZoMsx8S+4=; b=YYkNOj96PK4wPxfN+y6ZqoKrwLu9ErNWrFYC6xPn4luytAwdiaSHlJBBOPnx5Wy5Kx Sv5UL4zJFQanOd1pBvVo9eA0E/GFwPN0AsJ1bdjZN/uOgdu1UmzljntSviG7FJ6b6LTn nThr4OfDu1Agi1weFjvEGqRIP2xuz1Mti2uq0jo3djfEebLkMiV/+f9be1bT9rhRJYwA N1UdETNIToxNAr9c+lc9MJckZrxMU9Llh6sm+cx0rBR8yH/NQwhZZTN4horlfk4v5ALE eJAtE6zDFcSXkGEgCbLl4lYTJSDU8ICX2jT754go6+nQJfHxoh8aDSZTumsDeqJLGBT0 36tg== X-Gm-Message-State: AOJu0YxQsi+S/kLCdkCP+J1krBDh9e0EYGg9lhqv8P6TdTXCoeNxc/fy hnJj1cgNFaGfXWcTn6udgXoLDdScJyz3nO29qJ9bSPalGsfVGBukbG/M0v2Yng== X-Gm-Gg: ASbGncuyiGuzEDOBXBuGyuO7V/KelyIuGOlu4nYa1wd/oYOfUB5Pdd+c/pp9RFwWnX9 BDncewV4IqM/ls2CwRwiHX4j6fJpdfBlP91VA3P6TfTfRD5JEJPsxQs+Xu0nqrNPzAu7h0KArzI nvKJGQYMLlRVtPEnQBYy8XROU82anU36+fSB9DdG++sMMt1WaqzkkKgt/alSmh2tSWJl0+pqyAy IGO1EqXgrYqHe0Rhi+Kx8EeCkSl29hNe9+Opu24etPXecIHe+FlACTSJ65sdxV9Xollg9jP9zwJ GxC3R+Yd9STXWMmN68Jfgocw33UAzZZ5U68dOuSTybJwzFOInPuQB21oAR/RoLcG X-Google-Smtp-Source: AGHT+IGFwycr0MNbQFOV1fCZzlQzs/x1NFSlVGI+ncPaTwqZWshzPdELMDzWcXZBv4C6mIx99GV2wQ== X-Received: by 2002:a05:6e02:1807:b0:3dc:79e5:e696 with SMTP id e9e14a558f8ab-3ddbfc4ee10mr35293095ab.11.1749062265981; Wed, 04 Jun 2025 11:37:45 -0700 (PDT) Received: from smtpclient.apple ([162.218.223.15]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4fdd7e28da1sm2914694173.50.2025.06.04.11.37.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Jun 2025 11:37:45 -0700 (PDT) From: Matthew Tice Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.600.51.1.1\)) Subject: Re: Sudden increase in n_dead_tup with no corresponding insert/update/delete Date: Wed, 4 Jun 2025 12:37:34 -0600 In-Reply-To: Cc: pgsql-general@postgresql.org References: <006D484F-66AC-4734-A7E5-2EFBB6CEC1FA@gmail.com> Message-Id: <48926C17-302B-4C37-849F-E2092CADE9E0@gmail.com> X-Mailer: Apple Mail (2.3826.600.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Jun 3, 2025, at 6:23=E2=80=AFPM, David Rowley = wrote: >=20 > 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 >=20 >> Tue 03 Jun 2025 07:13:12 PM UTC (every 1s) >> n_dead_tup | 1290579 >> autoanalyze_count | 3079 >=20 >> 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. >=20 > 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. >=20 > See [1]. >=20 > David >=20 > [1] = https://github.com/postgres/postgres/blob/REL_15_STABLE/src/backend/comman= ds/analyze.c#L1318 Thanks, David. =20 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.=