pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Ignore BRIN indexes when checking for HOT udpates
5+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2023-08-10 b57cfb439b 1b594a326a  Document RelationGetIndexAttrBitmap better
* pgsql: Ignore BRIN indexes when checking for HOT udpates
@ 2021-11-30 19:04  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Tomas Vondra @ 2021-11-30 19:04 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ignore BRIN indexes when checking for HOT udpates

When determining whether an index update may be skipped by using HOT, we
can ignore attributes indexed only by BRIN indexes. There are no index
pointers to individual tuples in BRIN, and the page range summary will
be updated anyway as it relies on visibility info.

This also removes rd_indexattr list, and replaces it with rd_attrsvalid
flag. The list was not used anywhere, and a simple flag is sufficient.

Patch by Josef Simanek, various fixes and improvements by me.

Author: Josef Simanek
Reviewed-by: Tomas Vondra, Alvaro Herrera
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5753d4ee320b3f6fb2ff734667a1ce1d9d8615a1

Modified Files
--------------
doc/src/sgml/indexam.sgml                        | 11 +++
src/backend/access/brin/brin.c                   |  1 +
src/backend/access/gin/ginutil.c                 |  1 +
src/backend/access/gist/gist.c                   |  1 +
src/backend/access/hash/hash.c                   |  1 +
src/backend/access/heap/heapam.c                 |  2 +-
src/backend/access/nbtree/nbtree.c               |  1 +
src/backend/access/spgist/spgutils.c             |  1 +
src/backend/utils/cache/relcache.c               | 50 ++++++++------
src/include/access/amapi.h                       |  2 +
src/include/utils/rel.h                          |  3 +-
src/include/utils/relcache.h                     |  4 +-
src/test/modules/dummy_index_am/dummy_index_am.c |  1 +
src/test/regress/expected/brin.out               | 85 ++++++++++++++++++++++++
src/test/regress/sql/brin.sql                    | 63 ++++++++++++++++++
15 files changed, 202 insertions(+), 25 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Ignore BRIN indexes when checking for HOT updates
@ 2023-03-20 10:07  Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Tomas Vondra @ 2023-03-20 10:07 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Ignore BRIN indexes when checking for HOT updates

When determining whether an index update may be skipped by using HOT, we
can ignore attributes indexed by block summarizing indexes without
references to individual tuples that need to be cleaned up.

A new type TU_UpdateIndexes provides a signal to the executor to
determine which indexes to update - no indexes, all indexes, or only the
summarizing indexes.

This also removes rd_indexattr list, and replaces it with rd_attrsvalid
flag. The list was not used anywhere, and a simple flag is sufficient.

This was originally committed as 5753d4ee32, but then got reverted by
e3fcca0d0d because of correctness issues.

Original patch by Josef Simanek, various fixes and improvements by Tomas
Vondra and me.

Authors: Matthias van de Meent, Josef Simanek, Tomas Vondra
Reviewed-by: Tomas Vondra, Alvaro Herrera
Discussion: https://postgr.es/m/05ebcb44-f383-86e3-4f31-0a97a55634cf@enterprisedb.com
Discussion: https://postgr.es/m/CAFp7QwpMRGcDAQumN7onN9HjrJ3u4X3ZRXdGFT0K5G2JWvnbWg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/19d8e2308bc51ec4ab993ce90077342c915dd116

Modified Files
--------------
doc/src/sgml/indexam.sgml                        |  13 +++
src/backend/access/brin/brin.c                   |   1 +
src/backend/access/gin/ginutil.c                 |   1 +
src/backend/access/gist/gist.c                   |   1 +
src/backend/access/hash/hash.c                   |   1 +
src/backend/access/heap/heapam.c                 |  48 +++++++++-
src/backend/access/heap/heapam_handler.c         |  19 +++-
src/backend/access/nbtree/nbtree.c               |   1 +
src/backend/access/spgist/spgutils.c             |   1 +
src/backend/access/table/tableam.c               |   2 +-
src/backend/catalog/index.c                      |   9 +-
src/backend/catalog/indexing.c                   |  35 +++++--
src/backend/commands/copyfrom.c                  |   5 +-
src/backend/commands/indexcmds.c                 |  10 +-
src/backend/executor/execIndexing.c              |  37 ++++++--
src/backend/executor/execReplication.c           |   9 +-
src/backend/executor/nodeModifyTable.c           |  13 ++-
src/backend/nodes/makefuncs.c                    |   7 +-
src/backend/utils/cache/relcache.c               |  70 ++++++++++----
src/include/access/amapi.h                       |   2 +
src/include/access/heapam.h                      |   5 +-
src/include/access/tableam.h                     |  22 ++++-
src/include/executor/executor.h                  |   3 +-
src/include/nodes/execnodes.h                    |   2 +
src/include/nodes/makefuncs.h                    |   4 +-
src/include/utils/rel.h                          |   4 +-
src/include/utils/relcache.h                     |   5 +-
src/test/modules/dummy_index_am/dummy_index_am.c |   1 +
src/test/regress/expected/stats.out              | 111 +++++++++++++++++++++++
src/test/regress/sql/stats.sql                   |  82 +++++++++++++++++
30 files changed, 448 insertions(+), 76 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Ignore BRIN indexes when checking for HOT udpates
@ 2023-08-09 09:11  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Tomas Vondra <tomas.vondra@postgresql.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Alvaro Herrera @ 2023-08-09 09:11 UTC (permalink / raw)
  To: pgsql-hackers@lists.postgresql.org; +Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>; Tomas Vondra <tomas.vondra@postgresql.org>; Josef Šimánek <josef.simanek@gmail.com>

On 2021-Nov-30, Tomas Vondra wrote:

> Ignore BRIN indexes when checking for HOT udpates

I was trying to use RelationGetIndexAttrBitmap for something and
realized that its header comment does not really explain things very
well.  That was already the case before this commit, but it (this
commit) did add new possible values without mentioning them.  I propose
the attached comment-only patch.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
Al principio era UNIX, y UNIX habló y dijo: "Hello world\n".
No dijo "Hello New Jersey\n", ni "Hello USA\n".

Attachments:

  0001-Document-RelationGetIndexAttrBitmap-better.patch (text/x-diff, 0B) download

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Ignore BRIN indexes when checking for HOT udpates
@ 2023-08-09 15:56  Tomas Vondra <tomas.vondra@enterprisedb.com>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 5+ messages in thread

From: Tomas Vondra @ 2023-08-09 15:56 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; pgsql-hackers@lists.postgresql.org; +Cc: Matthias van de Meent <boekewurm+postgres@gmail.com>; Tomas Vondra <tomas.vondra@postgresql.org>; Josef Šimánek <josef.simanek@gmail.com>

On 8/9/23 11:11, Alvaro Herrera wrote:
> On 2021-Nov-30, Tomas Vondra wrote:
> 
>> Ignore BRIN indexes when checking for HOT udpates
> 
> I was trying to use RelationGetIndexAttrBitmap for something and
> realized that its header comment does not really explain things very
> well.  That was already the case before this commit, but it (this
> commit) did add new possible values without mentioning them.  I propose
> the attached comment-only patch.
> 

+1

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company





^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: pgsql: Ignore BRIN indexes when checking for HOT udpates
@ 2023-08-10 10:06  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Tomas Vondra <tomas.vondra@enterprisedb.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Alvaro Herrera @ 2023-08-10 10:06 UTC (permalink / raw)
  To: Tomas Vondra <tomas.vondra@enterprisedb.com>; +Cc: pgsql-hackers@lists.postgresql.org, Matthias van de Meent <boekewurm+postgres@gmail.com>; Tomas Vondra <tomas.vondra@postgresql.org>; Josef Šimánek <josef.simanek@gmail.com>

On 2023-Aug-09, Tomas Vondra wrote:

> On 8/9/23 11:11, Alvaro Herrera wrote:
> > I was trying to use RelationGetIndexAttrBitmap for something and
> > realized that its header comment does not really explain things very
> > well.  That was already the case before this commit, but it (this
> > commit) did add new possible values without mentioning them.  I propose
> > the attached comment-only patch.
> 
> +1

Thanks for looking!  Pushed now.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/





^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-08-10 10:06 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-11-30 19:04 pgsql: Ignore BRIN indexes when checking for HOT udpates Tomas Vondra <tomas.vondra@postgresql.org>
2023-08-09 09:11 ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2023-08-09 15:56   ` Tomas Vondra <tomas.vondra@enterprisedb.com>
2023-08-10 10:06     ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2023-03-20 10:07 pgsql: Ignore BRIN indexes when checking for HOT updates Tomas Vondra <tomas.vondra@postgresql.org>

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