From: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Optimize update of tables with generated columns |
Date: | 2019-12-21 06:47:29 |
Message-ID: | b05e781a-fa16-6b52-6738-761181204567@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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. This is also
related to the issue discussed in "logical replication does not fire
per-column triggers"[0]. I'll leave my patch here while that issue is
being resolved.
[0]:
https://www.postgresql.org/message-id/flat/21673e2d-597c-6afe-637e-e8b10425b240%402ndquadrant.com
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Optimize-update-of-tables-with-generated-columns.patch | text/plain | 7.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Thomas Munro | 2019-12-21 08:01:58 | Re: Preserve versions of initdb-created collations in pg_upgrade |
Previous Message | Peter Eisentraut | 2019-12-21 06:38:16 | Re: Preserve versions of initdb-created collations in pg_upgrade |