Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZ5Bs-0001IP-40 for pgsql-performance@arkaria.postgresql.org; Tue, 18 Dec 2018 02:33:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gZ5Bp-0001RO-So for pgsql-performance@arkaria.postgresql.org; Tue, 18 Dec 2018 02:32:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZ5Bp-0001RG-Hd for pgsql-performance@lists.postgresql.org; Tue, 18 Dec 2018 02:32:57 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gZ5Bm-0006DE-LW for pgsql-performance@lists.postgresql.org; Tue, 18 Dec 2018 02:32:56 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wBI2Wp80001248; Mon, 17 Dec 2018 21:32:51 -0500 From: Tom Lane To: Vladimir Ryabtsev cc: pgsql-performance@lists.postgresql.org Subject: Re: Why Postgres doesn't use TID scan? In-reply-to: References: <31790.1545097237@sss.pgh.pa.us> Comments: In-reply-to Vladimir Ryabtsev message dated "Mon, 17 Dec 2018 17:54:19 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1246.1545100371.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 17 Dec 2018 21:32:51 -0500 Message-ID: <1247.1545100371@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Vladimir Ryabtsev writes: > I see some recommendations in Internet to do like this (e.g. > https://stackoverflow.com/questions/5170546/how-do-i-delete-a-fixed-numb= er-of-rows-with-sorting-in-postgresql > ). > Did it really work in 2011? No, or at least not any better than today. (For context, "git blame" says I wrote the comment I just quoted to you in 2005. The feature it says isn't there wasn't there before that, either.) > Anyway I think the problem is pretty clear: I want to eventually clear t= he > table based on the predicate but I don't want to lock it for a long time= . DELETE doesn't lock the whole table. What problem are you actually facing? regards, tom lane