Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bVqbQ-0007Ee-8X for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Aug 2016 01:40:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bVqbP-0006Zh-Ra for pgsql-hackers@arkaria.postgresql.org; Sat, 06 Aug 2016 01:40:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bVqbP-0006Zb-Bv for pgsql-hackers@postgresql.org; Sat, 06 Aug 2016 01:40:39 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1bVqbM-0006qz-NI for pgsql-hackers@postgresql.org; Sat, 06 Aug 2016 01:40:38 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1bVqbL-0002rk-Gf; Fri, 05 Aug 2016 21:40:35 -0400 Date: Fri, 5 Aug 2016 21:40:35 -0400 From: Bruce Momjian To: Claudio Freire Cc: Pavan Deolasee , pgsql-hackers Subject: Re: Heap WARM Tuples - Design Draft Message-ID: <20160806014035.GD26927@momjian.us> References: <20160805175655.GE5068@momjian.us> <20160805192615.GG5068@momjian.us> <20160806000718.GB26927@momjian.us> <20160806010239.GC26927@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160806010239.GC26927@momjian.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -3.1 (---) 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 Fri, Aug 5, 2016 at 09:02:39PM -0400, Bruce Momjian wrote: > Yes, it seems we either find the entry fast and avoid the index > addition, or don't find it quickly and use a non-HOT, non-WARM update. > The problem is that you have to do this for multiple indexes, and if you > quickly find you need to add an entry to the first index, when you get > to the second one you can't easily bail out and go with a non-HOT, > non-WARM update. I suppose we could bail out of a long index search if > there is only one index with a changed key. > > Here's how I understand it --- if you are looking for a key that has > only a few index entries, it will be fast to find of the key/ctid is > listed. If the index has many index entries for the key, it will be > expensive to find if there is a matching key/ctid, but a read-only-query > index lookup for that key will be expensive too, whether you use the > bitmap scan or not. And, effectively, if we bail out and decide to go > with a non-HOT, non-WARM update, we are making the index even bigger. So to summarize again: o chains start out as HOT o they become WARM when some indexes change and others don't o for multiple index changes, we have to check all indexes for key/ctid matches o for single index changes, we can fail HOT and create a new non-HOT/WARM tuple if there are too many index matches o 99% of index checks will not find a key/ctid match I am not sure how to optimize an index non-match. -- 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