Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYPcN-0001xS-3i for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jun 2018 05:37:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYPcK-0001Mp-ML for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Jun 2018 05:37:16 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYPcK-0001Mc-Au for pgsql-hackers@lists.postgresql.org; Thu, 28 Jun 2018 05:37:16 +0000 Received: from mail.postgrespro.ru ([93.174.131.138]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYPcB-000159-W6 for pgsql-hackers@postgresql.org; Thu, 28 Jun 2018 05:37:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 28B9A21C1FC4; Thu, 28 Jun 2018 08:37:06 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.0.106] (unknown [5.79.139.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id D23AA21C1FC3; Thu, 28 Jun 2018 08:37:05 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1530164226; bh=WAjKUKxfI0Ozkss6Er5uAFuj2ufv7WC5zACkPEb+Zzo=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=OIO/YCharI9PPq5554fxYkt/5/Xw7Lq4BWUksqooEoXZAj/RfKCuE00NJZG8g+rX3 mquXP33yvEKrxOSpyXD2t9rn78Ocl3DOEhCvKEcGrh9yDPc/egoOv9UvArbIvNQHaR XvIYLtXMW0Mz4pAwQ8leWsN7RjoDkPw3jDbuFCkc= Subject: Re: [WIP] [B-Tree] Retail IndexTuple deletion To: Peter Geoghegan Cc: PostgreSQL Hackers , Masahiko Sawada References: <425db134-8bba-005c-b59d-56e50de3b41e@postgrespro.ru> <5affa50e-72a9-aef5-d71f-f5f551e01aaf@postgrespro.ru> From: "Andrey V. Lepikhov" Message-ID: <9a008ab3-f591-e5e9-8e03-c0dd1dc13579@postgrespro.ru> Date: Thu, 28 Jun 2018 10:36:44 +0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 28.06.2018 05:00, Peter Geoghegan wrote: > On Tue, Jun 26, 2018 at 11:40 PM, Andrey V. Lepikhov > wrote: >> I still believe that the patch for physical TID ordering in btree: >> 1) has its own value, not only for target deletion, >> 2) will require only a few local changes in my code, >> and this patches can be developed independently. > > I want to be clear on something now: I just don't think that this > patch has any chance of getting committed without something like my > own patch to go with it. The worst case for your patch without that > component is completely terrible. It's not really important for you to > actually formally make it part of your patch, so I'm not going to > insist on that or anything, but the reality is that my patch does not > have independent value -- and neither does yours. > As I wrote before in the last email, I will integrate TID sorting to my patches right now. Please, give me access to the last version of your code, if it possible. You can track the progress at https://github.com/danolivo/postgres git repository > I'm sorry if that sounds harsh, but this is a difficult, complicated > project. It's better to be clear about this stuff earlier on. Ok. It is clear now. > >> I prepare third version of the patches. Summary: >> 1. Mask DEAD tuples at a page during consistency checking (See comments for >> the mask_dead_tuples() function). >> 2. Still not using physical TID ordering. >> 3. Index cleanup() after each quick_vacuum_index() call was excluded. > > How does this patch affect opportunistic pruning in particular? Not > being able to immediately reclaim tuple space in the event of a dead > hot chain that is marked LP_DEAD could hurt quite a lot, including > with very common workloads, such as pgbench (pgbench accounts tuples > are quite a lot wider than a raw item pointer, and opportunistic > pruning is much more important than vacuuming). Is that going to be > acceptable, do you think? Have you measured the effects? Can we do > something about it, like make pruning behave differently when it's > opportunistic? This is the most "tasty" part of the work. I plan some experimental research on it at the end of patches developing (including TID sort) and parametrized opportunistic pruning for flexibility of switching between strategies on the fly. My current opinion on this question: we can develop flexible strategy based on parameters: free space at a block, frequency of UPDATE/DELETE queries, percent of DEAD tuples in a block/relation. Background cleaner, raised by heap_page_prune(), give an opportunity for using different ways for each block or relation. This technique should be able to configure from fully non-storage DEAD tuples+vacuum to all-storage DEAD tuples+target deletion by DB admin. > > Are you aware of the difference between _bt_delitems_delete() and > _bt_delitems_vacuum(), and the considerations for hot standby? I think > that that's another TODO list item for this patch. > Ok -- Andrey Lepikhov Postgres Professional: https://postgrespro.com The Russian Postgres Company