Re: [PATCH] Don't block HOT update by BRIN index

Alvaro Herrera <alvherre@alvh.no-ip.org>

From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Josef Šimánek <josef.simanek@gmail.com>
Cc: Tomas Vondra <tomas.vondra@enterprisedb.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2021-07-12T21:02:09Z
Lists: pgsql-hackers
On 2021-Jul-12, Josef Šimánek wrote:

> > 2) Do we actually need to calculate and store hotblockingattrs
> > separately in RelationGetIndexAttrBitmap? It seems to me it's either
> > NULL (with amhotblocking=false) or equal to indexattrs. So why not to
> > just get rid of hotblockingattr and rd_hotblockingattr, and do something
> > like
> >
> >   case INDEX_ATTR_BITMAP_HOT_BLOCKING:
> >     return (amhotblocking) ? bms_copy(rel->rd_hotblockingattr) : NULL;
> >
> > I haven't tried, so maybe I'm missing something?
> 
> relation->rd_indexattr is currently not used (at least I have not
> found anything) for anything, except looking if other values are
> already loaded.

Oh, that's interesting.  What this means is that INDEX_ATTR_BITMAP_ALL
is no longer used; its uses must have all been replaced by something
else.  It seems the only one that currently exists is for HOT in
heap_update, which this patch replaces with the new one.  In a quick
search, no external code depends on it, so I'd be inclined to just
remove it ...

I think a boolean is much simpler.  Consider a table with 1600 columns :-)

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/
"Puedes vivir sólo una vez, pero si lo haces bien, una vez es suficiente"



Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Ignore BRIN indexes when checking for HOT updates

  2. Move test for BRIN HOT behavior to stats.sql

  3. Ignore BRIN indexes when checking for HOT udpates