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 1kifJJ-0003Se-4u for pgsql-general@arkaria.postgresql.org; Fri, 27 Nov 2020 15:05:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kifJI-0006IX-4f for pgsql-general@arkaria.postgresql.org; Fri, 27 Nov 2020 15:05:20 +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 1kifJH-0006IQ-Sr for pgsql-general@lists.postgresql.org; Fri, 27 Nov 2020 15:05:19 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kifJF-0003Pf-Lm for pgsql-general@postgresql.org; Fri, 27 Nov 2020 15:05:18 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 73061EA3; Fri, 27 Nov 2020 10:05:16 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 27 Nov 2020 10:05:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=nQ8rOgG7eb890e+oB 8+cLJtf3XyZTTBm+JjVCTPRwyU=; b=MLBaSoqF+qnITu4Iy2ddhPH5naZzfF4Ol LMok5hZeDRBFfph1kK02+7tAe+my5oKcLaAwEvSGT4Vc2CJXjrAQpDJ8FbqEk394 ulwCTsRN/nnNCH9wNq9zDPcyLQwELzro8fgd2GLqhf+QonWuOCutSLHc5y+o9KzS CnXF6WeTYI3DL1N0fqSb4h9T9qCnqLdGdyQfoMM5FJXHf63OrdxdIJmEUcRV3ivg 8uNyDI6AWTKHXxMy9eEyZ/+6O3at/pYB/PnhC5LlVjIdetuUh5b+PW2xKK0W/Igm 0Fism7Wwq/7m7+6sm+RdfB/kA/QQwbEZ66y9nOj+QQvgwN9jB7faQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrudehgedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggujggfsehttdertddtredvnecuhfhrohhmpeetlhhvrghr ohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqe enucggtffrrghtthgvrhhnpeevgfelveegueejgefhgeetgefhgeehieefheehleetteei udeiiefhgffgheffteenucfkphepudeltddrleehrddukedrjeelnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.18.79]) by mail.messagingengine.com (Postfix) with ESMTPA id CD8163064AB3; Fri, 27 Nov 2020 10:05:14 -0500 (EST) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 9A7672A0D0C; Fri, 27 Nov 2020 12:05:12 -0300 (-03) Date: Fri, 27 Nov 2020 12:05:12 -0300 From: Alvaro Herrera To: Alexander Farber Cc: pgsql-general Subject: Re: Deleting takes days, should I add some index? Message-ID: <20201127150512.GA21099@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 2020-Nov-27, Alexander Farber wrote: > Referenced by: > TABLE "words_chat" CONSTRAINT "words_chat_gid_fkey" FOREIGN KEY (gid) > REFERENCES words_games(gid) ON DELETE CASCADE > TABLE "words_moves" CONSTRAINT "words_moves_gid_fkey" FOREIGN KEY (gid) > REFERENCES words_games(gid) ON DELETE CASCADE > TABLE "words_scores" CONSTRAINT "words_scores_gid_fkey" FOREIGN KEY > (gid) REFERENCES words_games(gid) ON DELETE CASCADE Make sure you have indexes on the gid columns of these tables. Delete needs to scan them in order to find the rows that are cascaded to. > So I ctrl-c (surprisingly not a single record was deleted; I was expecting > at least some to be gone) Ctrl-C aborts the transaction, so even though the rows are marked deleted, they are so by an aborted transaction. Therefore they're alive.