Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpxF-0007WP-1H for pgsql-admin@arkaria.postgresql.org; Thu, 03 Dec 2020 14:51:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkpxD-0002pc-Rt for pgsql-admin@arkaria.postgresql.org; Thu, 03 Dec 2020 14:51:31 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpxD-0002pU-Hk for pgsql-admin@lists.postgresql.org; Thu, 03 Dec 2020 14:51:31 +0000 Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkpxB-0005O3-6V for pgsql-admin@lists.postgresql.org; Thu, 03 Dec 2020 14:51:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=depesz.com; s=20170201; h=In-Reply-To:Content-Type:MIME-Version:References:Reply-To: Message-ID:Subject:Cc:To:Sender:From:Date:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A7iHfXTLkEcyt7L28x7V1LQvsmd/K8/J0tg1EauwDrQ=; b=Lnt3yDmIbiook5ry4gqIMM0jwd 7RjUvF2Cggnpx9mnvFLQXts/J8S9hfqrgesEecVmsMy7YJvLkZ8gWWebAkXypgLbBGX4FwRbF0+o/ QBW6BAZbcqp9MLj5zzQWB6vU5cItY9lm5WaGDjvLLCB75ByU+gVLmSn8je5mqmRzh1jE=; Received: from lana.depesz.com ([88.198.49.178] helo=depesz.com) by depesz.com with esmtpa (Exim 4.92) (envelope-from ) id 1kkpx8-0004Vz-HW; Thu, 03 Dec 2020 15:51:26 +0100 Date: Thu, 3 Dec 2020 15:51:26 +0100 From: hubert depesz lubaczewski Sender: depesz@depesz.com To: Atul Kumar Cc: pgsql-admin Subject: Re: time taking deletion on large tables Message-ID: <20201203145126.GA4726@depesz.com> Reply-To: depesz@depesz.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Dec 03, 2020 at 08:15:06PM +0530, Atul Kumar wrote: > Hi, > > The feed_posts table has over 50 Million rows. > > When I m deleting all rows of a certain type that are over 60 days old. The common solution to this problem is to partition, and then, instead of deleting rows - delete old partitions. depesz