Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bWoVG-0003LB-Sm for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2016 17:38:18 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bWoVG-0001kR-Fe for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2016 17:38:18 +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.84_2) (envelope-from ) id 1bWoVF-0001jn-Cm for pgsql-hackers@postgresql.org; Mon, 08 Aug 2016 17:38:17 +0000 Received: from momjian.us ([72.94.173.45]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bWoVB-0007RW-BL for pgsql-hackers@postgresql.org; Mon, 08 Aug 2016 17:38:16 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1bWoV8-0004IO-T9; Mon, 08 Aug 2016 13:38:10 -0400 Date: Mon, 8 Aug 2016 13:38:10 -0400 From: Bruce Momjian To: Pavan Deolasee Cc: Claudio Freire , pgsql-hackers Subject: Re: Heap WARM Tuples - Design Draft Message-ID: <20160808173810.GD16416@momjian.us> References: <20160806000718.GB26927@momjian.us> <20160806010239.GC26927@momjian.us> <20160806014035.GD26927@momjian.us> <20160806030433.GE26927@momjian.us> <20160806145121.GF26927@momjian.us> <20160807144945.GA22146@momjian.us> <20160807165501.GA16416@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160807165501.GA16416@momjian.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Sun, Aug 7, 2016 at 12:55:01PM -0400, Bruce Momjian wrote: > On Sun, Aug 7, 2016 at 10:49:45AM -0400, Bruce Momjian wrote: > > OK, crazy idea time --- what if we only do WARM chain additions when all > > indexed values are increasing (with NULLs higher than all values)? (If > > a key is always-increasing, it can't match a previous value in the > > chain.) That avoids the problem of having to check the WARM chain, > > except for the previous tuple, and the problem of pruning removing > > changed rows. It avoids having to check the index for matching key/ctid > > values, and it prevents CREATE INDEX from having to index WARM chain > > values. > > > > Any decreasing value would cause a normal tuple be created. > > Actually, when we add the first WARM tuple, we can mark the HOT/WARM > chain as either all-incrementing or all-decrementing. We would need a > bit to indicate that. FYI, is see at least two available tuple header bits here, 0x0800 and 0x1000: /* * information stored in t_infomask2: */ #define HEAP_NATTS_MASK 0x07FF /* 11 bits for number of attributes */ /* bits 0x1800 are available */ #define HEAP_KEYS_UPDATED 0x2000 /* tuple was updated and key cols * modified, or tuple deleted */ #define HEAP_HOT_UPDATED 0x4000 /* tuple was HOT-updated */ #define HEAP_ONLY_TUPLE 0x8000 /* this is heap-only tuple */ #define HEAP2_XACT_MASK 0xE000 /* visibility-related bits */ My guess is we would need one bit to mark a WARM chain, and perhaps reuse obsolete pre-9.0 HEAP_MOVED_OFF to indicate increment-only or decrement-only. These flags have to be passed to all forward tuples in the chain so an addition to the chain knows quickly if it is WARM chain, and which direction. We can't use the bits LP_REDIRECT lp_len because we need to create WARM chains before pruning, and I don't think walking the pre-pruned chain is worth it. (As I understand HOT, LP_REDIRECT is only created during pruning.) -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers