pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Claudio Freire <klaussfreire@gmail.com>
Cc: Pavan Deolasee <pavan.deolasee@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Heap WARM Tuples - Design Draft
Date: Fri, 5 Aug 2016 21:02:39 -0400
Message-ID: <20160806010239.GC26927@momjian.us> (raw)
In-Reply-To: <CAGTBQpaLgi4W4z-eRYPYGC=wnnQBxgN_20i9==4ryNbyR+YHeg@mail.gmail.com>
References: <CABOikdPgsknwYcWaPkU6ow5Zz-MZ644n_e-+bnOWqO2poeB2Cw@mail.gmail.com>
	<CAGTBQpYRzJWSynRfSV-00Dmty39R+pCnnyd8_L7zKw411NJOyQ@mail.gmail.com>
	<CABOikdMA_4PASw=C+YORCiq0cT4+-GY_LDDt89RDa4Cw3bOV0w@mail.gmail.com>
	<CAGTBQpZ_T_QB4nWihXtfqrvbHpJkx-SyGofC6=xqnkX-ppTx9g@mail.gmail.com>
	<20160805175655.GE5068@momjian.us>
	<CABOikdOL0E9uF5_Z=OMJvU2SbzUSc+c8q5-mOip+33HsFWw9ag@mail.gmail.com>
	<20160805192615.GG5068@momjian.us>
	<CAGTBQpbKoA=VJBVF8vyCXfmgzX359fueqvQWN9z-k+EoLkXs3Q@mail.gmail.com>
	<20160806000718.GB26927@momjian.us>
	<CAGTBQpaLgi4W4z-eRYPYGC=wnnQBxgN_20i9==4ryNbyR+YHeg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On Fri, Aug  5, 2016 at 09:21:49PM -0300, Claudio Freire wrote:
> On Fri, Aug 5, 2016 at 9:07 PM, Bruce Momjian <bruce@momjian.us> wrote:
> > On Fri, Aug  5, 2016 at 07:51:05PM -0300, Claudio Freire wrote:
> >> > This does create more HOT chains where the root ctid cannot be removed,
> >> > but it does avoid the index key/ctid check because any entry in the HOT
> >> > chain has identical keys.  What this would not handle is when an entire
> >> > HOT chain is pruned, as the keys would be gone.
> >>
> >> I believe the only solution is to use bitmap index scans with WARM indexes.
> >
> > Let me back up and explain the benefits we get from allowing HOT chains
> > to be WARM:
> >
> > *  no index entries for WARM indexes whose values don't change
> > *  improved pruning because the HOT/WARM chains can be longer because we
> >    don't have to break chains for index changes
> >
> > While I realize bitmap indexes would allow us to remove duplicate index
> > entries, it removes one of the two benefits of WARM, and it causes every
> > index read to be expensive --- I can't see how this would be a win over
> > doing the index check on writes.
> 
> But the index check could be prohibitely expensive.

True, but I am afraid the bitmap handling on reads will be worse.

> So we're back to bailing out?
> 
> When an update comes and we're considering WARM, we need to query the
> indexes, each one, and if one index cannot quickly verify the
> existence of an entry for the root tid for the key, bail out from
> WARM.

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 underestand 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.

-- 
  Bruce Momjian  <bruce@momjian.us>        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



view thread (75+ messages)  latest in thread

Message-ID: <20160806010239.GC26927@momjian.us>
Permalink:  ../20160806010239.GC26927@momjian.us/
Also on:    postgresql.org/message-id/20160806010239.GC26927@momjian.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: bruce@momjian.us, klaussfreire@gmail.com, pavan.deolasee@gmail.com
  Subject: Re: Heap WARM Tuples - Design Draft
  In-Reply-To: <20160806010239.GC26927@momjian.us>
  References: <CABOikdPgsknwYcWaPkU6ow5Zz-MZ644n_e-+bnOWqO2poeB2Cw@mail.gmail.com> <CAGTBQpYRzJWSynRfSV-00Dmty39R+pCnnyd8_L7zKw411NJOyQ@mail.gmail.com> <CABOikdMA_4PASw=C+YORCiq0cT4+-GY_LDDt89RDa4Cw3bOV0w@mail.gmail.com> <CAGTBQpZ_T_QB4nWihXtfqrvbHpJkx-SyGofC6=xqnkX-ppTx9g@mail.gmail.com> <20160805175655.GE5068@momjian.us> <CABOikdOL0E9uF5_Z=OMJvU2SbzUSc+c8q5-mOip+33HsFWw9ag@mail.gmail.com> <20160805192615.GG5068@momjian.us> <CAGTBQpbKoA=VJBVF8vyCXfmgzX359fueqvQWN9z-k+EoLkXs3Q@mail.gmail.com> <20160806000718.GB26927@momjian.us> <CAGTBQpaLgi4W4z-eRYPYGC=wnnQBxgN_20i9==4ryNbyR+YHeg@mail.gmail.com> <20160806010239.GC26927@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox