pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Augusto Callejas <acallejas@instructure.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: bitmap heap scan exact/lossy blocks and row removal
Date: Wed, 23 Dec 2020 19:57:02 -0500
Message-ID: <748833.1608771422@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+guOBicE+LwLGXLK1nd5msuRNH22nEZajthamKwgx2L68b=PQ@mail.gmail.com>
References: <CA+guOBicE+LwLGXLK1nd5msuRNH22nEZajthamKwgx2L68b=PQ@mail.gmail.com>

Augusto Callejas <acallejas@instructure.com> writes:
> I created a GIN index on the following relation and ran an EXPLAIN query on
> a query, and noticed that despite all heap blocks being exact, that the
> outermost bitmap heap scan removed 62 rows after recheck. My understanding
> (mainly from
> https://paquier.xyz/postgresql-2/postgres-9-4-feature-highlight-lossyexact-pages-for-bitmap-heap-sca...)
> is that if there are only exact pages, then there are only tuples in the
> bitmap, so I wouldn't expect to see rows being removed by the recheck.

"exact" in that context just means that the bitmap mechanism didn't
forget any details about which row TIDs were returned by the index.
But the index itself could be lossy, ie it can return some rows that only
*might* match the query.  The recheck mechanism exists mainly for that
purpose --- backstopping a lossy bitmap was something we tacked on later.

An example here is that a trigram index will only tell you which rows
contain the same trigrams that the query string does.  Whether they are
in the right order has to be verified by a recheck of the original query
operator applied to the real data.

			regards, tom lane





view thread (2+ messages)

Message-ID: <748833.1608771422@sss.pgh.pa.us>
Permalink:  ../748833.1608771422@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/748833.1608771422@sss.pgh.pa.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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, acallejas@instructure.com
  Subject: Re: bitmap heap scan exact/lossy blocks and row removal
  In-Reply-To: <748833.1608771422@sss.pgh.pa.us>
  References: <CA+guOBicE+LwLGXLK1nd5msuRNH22nEZajthamKwgx2L68b=PQ@mail.gmail.com> <748833.1608771422@sss.pgh.pa.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