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 1ga7P4-00077Y-C0 for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Dec 2018 23:06:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ga7P3-00066A-1W for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Dec 2018 23:06:53 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ga7P2-000661-QR for pgsql-hackers@lists.postgresql.org; Thu, 20 Dec 2018 23:06:52 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ga7Ow-0005tS-LD for pgsql-hackers@lists.postgresql.org; Thu, 20 Dec 2018 23:06:52 +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 wBKN6frD010209; Thu, 20 Dec 2018 18:06:41 -0500 From: Tom Lane To: Andres Freund cc: Edmund Horner , David Rowley , tomas.vondra@2ndquadrant.com, PostgreSQL Developers Subject: Re: Tid scan improvements In-reply-to: <20181220223359.beygiujulocdbmas@alap3.anarazel.de> References: <8469.1545344467@sss.pgh.pa.us> <20181220223359.beygiujulocdbmas@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Thu, 20 Dec 2018 14:33:59 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <10207.1545347201.1@sss.pgh.pa.us> Date: Thu, 20 Dec 2018 18:06:41 -0500 Message-ID: <10208.1545347201@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andres Freund writes: > On 2018-12-20 17:21:07 -0500, Tom Lane wrote: >> I'm having a hard time wrapping my mind around why you'd bother with >> backwards TID scans. > I've not followed this thread, but wouldn't that be quite useful to be > able to move old tuples to free space earlier in the table? > I've written multiple scripts that update the later pages in a table, to > force reuse of earlier free pages (in my case by generating ctid = ANY() > style queries with all possible tids for the last few pages, the most > efficient way I could think of). Sure, but wouldn't you now write those using something on the order of WHERE ctid >= '(cutoff_page_here, 1)' ? I don't see that you'd want to write "ORDER BY ctid DESC LIMIT n" because you wouldn't know what value of n to use to get all the tuples on some-number-of-ending-pages. regards, tom lane