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.96) (envelope-from ) id 1vkwHA-004lve-02 for pgsql-general@arkaria.postgresql.org; Wed, 28 Jan 2026 03:31:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vkwH9-00Gy5Y-09 for pgsql-general@arkaria.postgresql.org; Wed, 28 Jan 2026 03:31:27 +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.96) (envelope-from ) id 1vkwH8-00Gy5P-2I for pgsql-general@lists.postgresql.org; Wed, 28 Jan 2026 03:31:27 +0000 Received: from mail-oa1-x2b.google.com ([2001:4860:4864:20::2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vkwH6-00000000oRP-2cUu for pgsql-general@lists.postgresql.org; Wed, 28 Jan 2026 03:31:26 +0000 Received: by mail-oa1-x2b.google.com with SMTP id 586e51a60fabf-40439fb8584so379720fac.0 for ; Tue, 27 Jan 2026 19:31:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769571083; cv=none; d=google.com; s=arc-20240605; b=GmMPOGdJM5/1QNfDGRrqVIH/SsBDAhD3vnl0sepzAipxV5QvQMOupeRX8JGt0gehfM Zf1J22IEpaFN8wNQUpQ56p0x/PXzCqH9m2KRVkaHvIwf3kItwm9JKXQc0DWSoDjhlOWT KgseO50mfmU3v88C86TamBUWbUM13M8Rm2YcpjpzHY1UIgJ33DBPKQhqDsNSMDcTMC9E +rwVvRptI/h1avPIqH3W8pDFK9zZ7IHW/eBllbOCNPP/FlBtNRc8symSJZJ4JYYHSmGH Fy1cRP1RbqVu2sJQup830ePYjaFs1T5Fs3e/Pyj0B/neO12vnJWvaOHDJ7KCE84jDFnx XlVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature; bh=+K/jLtZtXlOo4wswt3sUsHdyYLZ5L1WeAA7Hbdc+i9s=; fh=iustGK7nnrMY6L5im5X4eDfBy4adRuOIV7yrP7msASY=; b=Q+er2pqam4CNuNG6s8Br5GT5uiPKvxA5mWwC41tZVuOajGCialLGZzjYXXqbBeVFIT LeTd1/hZVf5zpTAJiw6QeLfhBF84EjVa+R7k661Ge8aDy3ZGG+XYmIww2el6+VTbfMRR +3TfOSlbHsVBFPmSR2f8e8e6m6yKWVTJtfCuEsKbNGeudZkaHbqQAPoJeUjvZQj2loNH ZMsBlyeszXPl5bwLo1drN8cgzqzoQ71KOX6Uaecmg+ZTpr32i7mQO4eYHAYcvUDCOBsJ w7Uw3hu+pT+P8Cf7XbK6J94PA4hctjfsBGtsiTWurMWX3DpPNoEO4cqWRrYrQdyAuSsx OgHQ==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769571083; x=1770175883; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=+K/jLtZtXlOo4wswt3sUsHdyYLZ5L1WeAA7Hbdc+i9s=; b=CDSP5ImBnnMaWDtPDRguWMySZ3TdknyyhA4my5Hz/hg09GiQkXRcTkLikDhDbS2R+w hnm76nt7ynnOH68YGwKmAAA9GbMa0/2RQvVyGZhQbMtX7g9I2VquRAcJ5ipGY6XRL29M P89bu0vfa4TOqC85h0mP/GJMZAfmyoMM2w0bKmkPE8nBPAYZWJtREdjEH60FplOCNLjb eZWDFOHSglwOiUNlT3Log4CAwU+xi0RJhjtjgjJK83f1+GWU/R9uONzqny2zeKF4EfNd 4DR3uuNHXfFeIb1liYVEPUWyn+eq/mvouPkiBJLbNJiab5GLWM2ldA1UWot0KxBqeX3p 5uxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769571083; x=1770175883; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+K/jLtZtXlOo4wswt3sUsHdyYLZ5L1WeAA7Hbdc+i9s=; b=F17MdEhgLjXOCjdy7K7csDzo7XtNXfYktFQ5EEAKLA9Jz/UlTx6QZWxS/dtDxhf7ql kwjpeAXBdUTuUBFpc/XwdqTCHdM9eeMqMAl87if06dpFWpS+a8kxh/8xXiDR9yy/oOia +LZlFWnt5bSqz4o3AMFH6k1lwcnjxWBBmV8907G3AluLCcpaaplXX9NCH6vTNMlshTkC Z89No3ROji2GsmR0sVKlPWANOhH3iaK48RSeMs66OZre150G/ukavGARrz/WzRUY25Y9 RksVyObzea7oVDrcoi8JRZ+ne1Dm5aB0f1m4m2GJEADFXJy59hoxF/OBcwUKi4IXZ0jz wrWA== X-Gm-Message-State: AOJu0YzskwsOerEHFQmMhA93azkW5daxo6hZn9zCrwaAoEQkiFhcIqoR 3ntBfgGQRG3eLZg3aRAYUXM08FVKMRYEBqiHQjD8jMYmCaUDYhd/ayMPHovJ89e827WxT6+HnRg 65OXP3MF3uSKq54ubCsrx0bhGCJfhG1Za08ss X-Gm-Gg: AZuq6aIleOhmpvpU0SN0v7f+ovCyCFWA46K8mov3XTA+ijtPvUPNYdFhe8zj6rHgSEo Ey5HqaIcOcYfljFg/J6JAsT4oNdOV8bP4G0hJ6sRyh9/Tr7aRNMWa+UBkl0aE4hS5RO93GfKYzH Lpu3k3/VHjRvhI9juzzFZLWXDs1Ca5Wi1ZUuTJ/rpB8iD3ybneucKCqZlDKv9rQEaJPCJtOBequ uiExVoz6YLXDs0eQlnlX4aLRAdSsAjMtOo6+8e90BZv0L92bI4Ti7P8vVRTGwIzllvWzu5/ X-Received: by 2002:a05:6820:1785:b0:662:89e0:2308 with SMTP id 006d021491bc7-662f203a67amr2205632eaf.8.1769571082779; Tue, 27 Jan 2026 19:31:22 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a05:6802:604d:20b0:619:b970:e659 with HTTP; Tue, 27 Jan 2026 19:31:22 -0800 (PST) In-Reply-To: References: From: "David G. Johnston" Date: Tue, 27 Jan 2026 20:31:22 -0700 X-Gm-Features: AZwV_QgPmHmvpBHrVs9a77H-abzNBs6Jz1aVPLqRp3eEXtK-qKPO2lfYQhEIYk8 Message-ID: Subject: Re: Attempting to delete excess rows from table with BATCH DELETE To: Gus Spier Cc: pgsql-general Content-Type: multipart/alternative; boundary="000000000000cb43ae06496a5fd0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000cb43ae06496a5fd0 Content-Type: text/plain; charset="UTF-8" On Tuesday, January 27, 2026, Gus Spier wrote: > Environment: AWS RDS Aurora for PostgreSQL 15 hosting tables that > support scientific research. The development environment predominantly > uses JPA with Hibernate. > > Years of neglect have allowed mission tables to accumulate hundreds of > millions of rows of excess data. The developers and the customer > decided we must delete all rows older than 75 days. Table partitioning > was briefly considered but discarded because of the effort needed to > refactor the codebase. > > I proposed the straight-forward course of action: delete by batches > from the victim tables. > > Strongly encourage you to try to accomplish your goal without any delete commands at that scale that causes vacuuming. Can you just create an empty copy and load the data to keep into it then point at the newly filled database? Truncate is OK. Daily trimming going forward would be less problematic at least. David J. --000000000000cb43ae06496a5fd0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tuesday, January 27, 2026, Gus Spier <gus.spier@gmail.com> wrote: