Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit92e1583

Browse files
committed
Don't do logical replication of TRUNCATE of zero tables
When due to publication configuration, a TRUNCATE change ends up withzero tables to be published, don't send the message out, just skip it.It's not wrong, but obviously useless overhead.
1 parente348e7a commit92e1583

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

‎src/backend/replication/pgoutput/pgoutput.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,16 @@ pgoutput_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
407407
maybe_send_schema(ctx,relation,relentry);
408408
}
409409

410-
OutputPluginPrepareWrite(ctx, true);
411-
logicalrep_write_truncate(ctx->out,
412-
nrelids,
413-
relids,
414-
change->data.truncate.cascade,
415-
change->data.truncate.restart_seqs);
416-
OutputPluginWrite(ctx, true);
410+
if (nrelids>0)
411+
{
412+
OutputPluginPrepareWrite(ctx, true);
413+
logicalrep_write_truncate(ctx->out,
414+
nrelids,
415+
relids,
416+
change->data.truncate.cascade,
417+
change->data.truncate.restart_seqs);
418+
OutputPluginWrite(ctx, true);
419+
}
417420

418421
MemoryContextSwitchTo(old);
419422
MemoryContextReset(data->context);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp