Re: Optimize update of tables with generated columns

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Optimize update of tables with generated columns
Date: 2020-02-13 13:39:41
Message-ID: 65fb745d-4c1a-7582-d61b-1686d8c5c85d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2019-12-21 07:47, Peter Eisentraut wrote:
> When updating a table row with generated columns, we only need to
> recompute those generated columns whose base columns have changed in
> this update and keep the rest unchanged. This can result in a
> significant performance benefit (easy to reproduce for example with a
> tsvector column). The required information was already kept in
> RangeTblEntry.extraUpdatedCols; we just have to make use of it.
>
> A small problem is that right now ExecSimpleRelationUpdate() does not
> populate extraUpdatedCols. That needs fixing first.

Here is an updated patch set that contains a fix for the issue above
(should be backpatched IMO) and the actual performance patch as before.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment Content-Type Size
v2-0001-Fill-in-extraUpdatedCols-in-logical-replication.patch text/plain 3.1 KB
v2-0002-Optimize-update-of-tables-with-generated-columns.patch text/plain 7.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2020-02-13 13:40:32 Re: allow running parts of src/tools/msvc/ under not Windows
Previous Message Pavel Stehule 2020-02-13 13:25:46 Re: [HACKERS] [PATCH] Generic type subscripting