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 1tYAsx-0058rb-CJ for pgsql-admin@arkaria.postgresql.org; Wed, 15 Jan 2025 21:25:12 +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 1tYAsv-000FPV-DW for pgsql-admin@arkaria.postgresql.org; Wed, 15 Jan 2025 21:25:09 +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 1tYAsu-000FPN-VC for pgsql-admin@lists.postgresql.org; Wed, 15 Jan 2025 21:25:09 +0000 Received: from mail-yb1-xb30.google.com ([2607:f8b0:4864:20::b30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tYAss-000cpQ-2Z for pgsql-admin@lists.postgresql.org; Wed, 15 Jan 2025 21:25:09 +0000 Received: by mail-yb1-xb30.google.com with SMTP id 3f1490d57ef6-e549b0f8d57so431929276.3 for ; Wed, 15 Jan 2025 13:25:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=evaristesys-com.20230601.gappssmtp.com; s=20230601; t=1736976304; x=1737581104; darn=lists.postgresql.org; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:from:to:cc:subject:date:message-id :reply-to; bh=L7G0xEs3yHVq5zSKWdAtKFE/5XYZQJeipDzwvvJecME=; b=NOiPlB1gltDDXsdmi51qbCkSmKE463sl5T5VDM4KZWATsvLiEmPADO6ZpY59ZiWmym oGg7KrCkV/G2ShNzrRioc6yGXBdcpK5iMFa0t9MC0dNU9C+wjRKYg1Jd3/8ayHnGX9up 1d6rJLooX6sThBVk3X9bPjzGA9F2gRr1ZmrAqXtaglQrkbxNOJY1fWN/d+M2cgWjZg/k xWbCogTs9U9s5n0K8Stv/AwIgWVj7GbI8rR00YHq9YPpHpxEACNL5qOhT0tiodZiuTk9 5WJE7tJASuBfd+PWH3qU5wns5BJ/Kj8qFvESS6E8gWbMK/BAXc5N7UcLnZ9GU5IvkxNM y3gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736976304; x=1737581104; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L7G0xEs3yHVq5zSKWdAtKFE/5XYZQJeipDzwvvJecME=; b=nWno5H8+2CG+SWpKy/NAcrZFTwLBRvcAhvtTYHDgW//rLn43fLB3yf0fDh+wADRGHu v4k7+t+hHdSMOC5Tj9IlIwSZrMccgDGvxPCYGcviCDkjvzoaiex4/QLzMOGtbJlE9Bio dr7vafkL41SvR53bCO06NeAcqc4Kbdl8XruAmWMbCDdryC9uvHENWsW1GvjT+1p6C0Z7 fuBJhMa3LIuzYvA2MwWWzFzXYnQV3fyXQd+7DoyqJAfdA8YW3fdsrmeaWTDxG0hB2tPM iZue5go2gnWLcEQIL9RLZQEktmPC+Zxj/p6q2aq1ct3HqjYePS+hS3zi/DV46LYGGGJM J3yQ== X-Gm-Message-State: AOJu0YxfBRPJbYKYdY+xAfzVHZMQodzAdMESysb3rac0mdlOz8q7/OSk eEzd67Yj+DCW0iUt7g++C5RTEabofmUsXEKFitob6MVbWYkt1Tq8xRkrgzh9rEEYKwLfxPlEGi2 NugU= X-Gm-Gg: ASbGncuawCqF08wIQY5tVgwUogG+O4x9UF1xCZMUKX3XfjEYD6bnBt/ct6g5dzywITd V+IfpwMag5BMppRxWD/uMWLR0L/7DqK8dTQ8VA4HTENrvYVzci/BmCotqfDQqSfmuEZc7MDR9hu FQ348iV6bEXbPaV9k+ABjzzodN0holxaeIOJtRMzcu2TGKGLjxCIs8OFYTKxzQnpkX3o0n5/a14 WrUrFrxSVB7SRDekDfNhLmzxO6txhinwGLypDk/Gv4jjYPvoGKYzS0nM9T02HAfv6WcgO+2PARx IWLEz7GFZ0Kzp7v3jjBu4d9ePaGGlAa/rwiAp2ch3A== X-Google-Smtp-Source: AGHT+IHO17WMi95eBeE1dx3zF1qP7Kku2PkqmAKE0NTOHLPRUi5uHYeOADzhQ2NPFHg0nzNzySBK8g== X-Received: by 2002:a05:690c:b17:b0:6ee:66d2:e738 with SMTP id 00721157ae682-6f5311e4ab2mr263337987b3.2.1736976304512; Wed, 15 Jan 2025 13:25:04 -0800 (PST) Received: from smtpclient.apple (syn-047-044-036-075.biz.spectrum.com. [47.44.36.75]) by smtp.gmail.com with ESMTPSA id 00721157ae682-6f546c25dc1sm26819887b3.22.2025.01.15.13.25.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Jan 2025 13:25:04 -0800 (PST) From: Alex Balashov Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.300.87.4.3\)) Subject: Re: Need an idea to operate massive delete operation on big size table. Date: Wed, 15 Jan 2025 16:24:53 -0500 References: <82cbc03d6bae358db66430f5518abd6b1a683571.camel@cybertec.at> To: pgsql-admin@lists.postgresql.org In-Reply-To: <82cbc03d6bae358db66430f5518abd6b1a683571.camel@cybertec.at> Message-Id: X-Mailer: Apple Mail (2.3826.300.87.4.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk In my experience, mass deletions are tough. There may be a supporting = index to assist the broadest criteria, but the filtered rows that result = must still be sequentially scanned for non-indexed sub-criteria[1]. That = can still be an awful lot of rows and a huge, time-consuming workload.=20= While it won't help with deduplication, partitioning is a very good, if = somewhat labour-intensive solution to the problem of aging old data off = the back of a rolling archive. Once upon a time, I had an installation = with a periodic hygienic `DELETE` once or twice a year, which took many = hours to plan and execute, and placed considerable demand on the system. = We switched to monthly partitioning and the result was, to some, = indistinguishable from magic.=20 -- Alex [1] Which normally doesn't make sense to index, in the overall tradeoff = of index size and maintenance overhead vs. performance payoff. --=20 Alex Balashov Principal Consultant Evariste Systems LLC Web: https://evaristesys.com Tel: +1-706-510-6800