Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bfUf3-0000j2-D0 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2016 16:16:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bfUf2-0003Wo-OD for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Sep 2016 16:16:16 +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 1bfUde-0001w9-Se for pgsql-hackers@postgresql.org; Thu, 01 Sep 2016 16:14:51 +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 1bfUdb-0001M2-Rp for pgsql-hackers@postgresql.org; Thu, 01 Sep 2016 16:14:49 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1bfUda-0001Rh-1f; Thu, 01 Sep 2016 12:14:46 -0400 Date: Thu, 1 Sep 2016 12:14:46 -0400 From: Bruce Momjian To: Pavan Deolasee Cc: pgsql-hackers Subject: Re: Patch: Write Amplification Reduction Method (WARM) Message-ID: <20160901161446.GA25168@momjian.us> References: <20160831200329.GC31352@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -3.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 Thu, Sep 1, 2016 at 02:37:40PM +0530, Pavan Deolasee wrote: > I like the simplified approach, as long as it doesn't block further > improvements. > > > > Yes, the proposed approach is simple yet does not stop us from improving things > further. Moreover it has shown good performance characteristics and I believe > it's a good first step. Agreed. This is BIG. Do you think it can be done for PG 10? > Thanks. What's also interesting and something that headline numbers don't show > is that WARM TPS is as much as 3 times of master TPS when the percentage of > WARM updates is very high. Notice the spike in TPS in the comparison graph. > > Results with non-default heap fill factor are even better. In both cases, the > improvement in TPS stays constant over long periods.  Yes, I expect the benefits of this to show up in better long-term performance. > > During first heap scan of VACUUM, we look for tuples with HEAP_WARM_TUPLE > set. > > If all live tuples in the chain are either marked with Blue flag or Red > flag > > (but no mix of Red and Blue), then the chain is a candidate for HOT > conversion. > > Uh, if the chain is all blue, then there is are WARM entries so it > already a HOT chain, so there is nothing to do, right? > > > For aborted WARM updates, the heap chain may be all blue, but there may still > be a red index pointer which must be cleared before we allow further WARM > updates to the chain. Ah, understood now. Thanks. > Why not just remember the tid of chains converted from WARM to HOT, then > use "amrecheck" on an index entry matching that tid to see if the index > matches one of the entries in the chain.  > > > That will require random access to heap during index vacuum phase, something I > would like to avoid. But we can have that as a fall back solution for handling > aborted vacuums.  Yes, that is true. So the challenge is figuring how which of the index entries pointing to the same tid is valid, and coloring helps with that? > (It will match all of them or > none of them, because they are all red.)  I don't see a point in > coloring the index entries as reds as later you would have to convert to > blue in the WARM-to-HOT conversion, and a vacuum crash could lead to > inconsistencies.  > > > Yes, that's a concern since the conversion of red to blue will also need to WAL > logged to ensure that a crash doesn't leave us in inconsistent state. I still > think that this will be an overall improvement as compared to allowing one WARM > update per chain. OK. I will think some more on this to see if I can come with another approach. >   > > Consider that you can just call "amrecheck" on the few > chains that have converted from WARM to HOT.  I believe this is more > crash-safe too.  However, if you have converted WARM to HOT in the heap, > but crash durin the index entry removal, you could potentially have > duplicates in the index later, which is bad. > > As you probably already noted, we clear heap flags only after all indexes are > cleared of duplicate entries and hence a crash in between should not cause any > correctness issue. As long as heap tuples are marked as warm, amrecheck will > ensure that only valid tuples are returned to the caller. OK, got it. -- 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