diff options
author | Peter Eisentraut | 2020-02-17 14:19:58 +0000 |
---|---|---|
committer | Peter Eisentraut | 2020-02-17 14:20:58 +0000 |
commit | c6679e4fca21d253ced84c51ac1a31c1b2aec72f (patch) | |
tree | af48ab74e7d45752731f72081c303ca98aa969cc /src/backend/executor/execReplication.c | |
parent | ad3ae64770e5b4391ad07fb2a689d72aa45b4689 (diff) |
Optimize update of tables with generated columns
When updating a table row with generated columns, only 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. The required information was already kept in
RangeTblEntry.extraUpdatedCols; we just have to make use of it.
Reviewed-by: Pavel Stehule <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/[email protected]
Diffstat (limited to 'src/backend/executor/execReplication.c')
-rw-r--r-- | src/backend/executor/execReplication.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 30cba89da7e..7194becfd99 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -419,7 +419,7 @@ ExecSimpleRelationInsert(EState *estate, TupleTableSlot *slot) /* Compute stored generated columns */ if (rel->rd_att->constr && rel->rd_att->constr->has_generated_stored) - ExecComputeStoredGenerated(estate, slot); + ExecComputeStoredGenerated(estate, slot, CMD_INSERT); /* Check the constraints of the tuple */ if (rel->rd_att->constr) @@ -485,7 +485,7 @@ ExecSimpleRelationUpdate(EState *estate, EPQState *epqstate, /* Compute stored generated columns */ if (rel->rd_att->constr && rel->rd_att->constr->has_generated_stored) - ExecComputeStoredGenerated(estate, slot); + ExecComputeStoredGenerated(estate, slot, CMD_UPDATE); /* Check the constraints of the tuple */ if (rel->rd_att->constr) |