mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Don't do logical replication of TRUNCATE of zero tables
When due to publication configuration, a TRUNCATE change ends up with zero tables to be published, don't send the message out, just skip it. It's not wrong, but obviously useless overhead.
This commit is contained in:
parent
e348e7ae57
commit
92e1583b43
@ -407,13 +407,16 @@ pgoutput_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
|
|||||||
maybe_send_schema(ctx, relation, relentry);
|
maybe_send_schema(ctx, relation, relentry);
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputPluginPrepareWrite(ctx, true);
|
if (nrelids > 0)
|
||||||
logicalrep_write_truncate(ctx->out,
|
{
|
||||||
nrelids,
|
OutputPluginPrepareWrite(ctx, true);
|
||||||
relids,
|
logicalrep_write_truncate(ctx->out,
|
||||||
change->data.truncate.cascade,
|
nrelids,
|
||||||
change->data.truncate.restart_seqs);
|
relids,
|
||||||
OutputPluginWrite(ctx, true);
|
change->data.truncate.cascade,
|
||||||
|
change->data.truncate.restart_seqs);
|
||||||
|
OutputPluginWrite(ctx, true);
|
||||||
|
}
|
||||||
|
|
||||||
MemoryContextSwitchTo(old);
|
MemoryContextSwitchTo(old);
|
||||||
MemoryContextReset(data->context);
|
MemoryContextReset(data->context);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user