[prev in list] [next in list] [prev in thread] [next in thread] 

List:       postgresql-general
Subject:    Logical Replication - One table 8 minutes, Identical Two Tables 28 Minutes (Expected 16 Minutes)
From:       Avi Weinberg <AviW () gilat ! com>
Date:       2021-12-27 13:35:58
Message-ID: DB9PR07MB7180E7A4CD39D54A7DE78673CB429 () DB9PR07MB7180 ! eurprd07 ! prod ! outlook ! com
[Download RAW message or body]

Hi All,

When I have only one table (2.5GB) in logical replication publication it takes 8 \
minutes to sync to the subscriber when I created a copy of the table and added it to \
the publication it took 28 minutes.  When I sync three IDENTICAL tables of the same \
size it take 46 minutes! I expected the tables to be synched in parallel or at least \
one after the other, but it turned out the time increase is much larger than just to \
sync additional table of the same size.  Two tables should be 8*2=16 minutes and not \
28 and three tables should be 8*3=24 minutes and not 46.

The table has one pk int column and one binary column file_content of type bytea.

What might be the reason for this behavior? Can I improve the time it takes to sync \
several tables so it will be no more than the (time to sync one table) * (number of \
tables)

Doing it for two tables took 28 minutes
2021-12-27 10:32:13.740 UTC [4430] LOG:  logical replication apply worker for \
subscription "sub_gwn1" has started 2021-12-27 10:32:13.815 UTC [4431] LOG:  logical \
replication table synchronization worker for subscription "sub_gwn1", table "p1" has \
started 2021-12-27 10:32:13.827 UTC [4432] LOG:  logical replication table \
synchronization worker for subscription "sub_gwn1", table "p" has started 2021-12-27 \
10:57:57.542 UTC [4432] LOG:  logical replication table synchronization worker for \
subscription "sub_gwn1", table "p" has finished 2021-12-27 11:00:03.806 UTC [4431] \
LOG:  logical replication table synchronization worker for subscription "sub_gwn1", \
table "p1" has finished

Doing it for three tables took 46 minutes
2021-12-27 11:49:11.931 UTC [4739] LOG:  logical replication table synchronization \
worker for subscription "sub_gwn1", table "p2" has started 2021-12-27 11:49:11.948 \
UTC [4740] LOG:  logical replication table synchronization worker for subscription \
"sub_gwn1", table "p1" has started 2021-12-27 12:23:44.673 UTC [4740] LOG:  logical \
replication table synchronization worker for subscription "sub_gwn1", table "p1" has \
finished 2021-12-27 12:23:44.783 UTC [4845] LOG:  logical replication table \
synchronization worker for subscription "sub_gwn1", table "p" has started 2021-12-27 \
12:28:53.320 UTC [4739] LOG:  logical replication table synchronization worker for \
subscription "sub_gwn1", table "p2" has finished 2021-12-27 12:35:49.156 UTC [4845] \
LOG:  logical replication table synchronization worker for subscription "sub_gwn1", \
table "p" has finished

Thanks!

IMPORTANT - This email and any attachments is intended for the above named \
addressee(s), and may contain information which is confidential or privileged. If you \
are not the intended recipient, please inform the sender immediately and delete this \
email: you should not copy or use this e-mail for any purpose nor disclose its \
contents to any person.


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	text-align:right;
	direction:rtl;
	unicode-bidi:embed;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri",sans-serif;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Hi \
All,<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">When I \
have only one table (2.5GB) in logical replication publication it takes 8 minutes to \
sync to the subscriber when I created a copy of the table and added it to the \
publication  it took 28 minutes.&nbsp; When I sync three IDENTICAL tables of the same \
size it take 46 minutes!<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">I expected the tables to be \
synched in parallel or at least one after the other, but it turned out the time \
increase is much larger than just to sync additional table of the same  size.&nbsp; \
Two tables should be 8*2=16 minutes and not 28 and three tables should be 8*3=24 \
minutes and not 46.<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">The table \
has one pk int column and one binary column file_content of type \
bytea.<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">What might \
be the reason for this behavior? Can I improve the time it takes to sync several \
tables so it will be no more than the (time to sync one table) * (number of \
tables)<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Doing it \
for two tables took 28 minutes<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 10:32:13.740 UTC \
[4430] LOG:&nbsp; logical replication apply worker for subscription \
&quot;sub_gwn1&quot; has started<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 10:32:13.815 UTC \
[4431] LOG:&nbsp; logical replication table synchronization worker for subscription \
&quot;sub_gwn1&quot;, table &quot;p1&quot; has started<o:p></o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 \
10:32:13.827 UTC [4432] LOG:&nbsp; logical replication table synchronization worker \
for subscription &quot;sub_gwn1&quot;, table &quot;p&quot; has started<o:p></o:p></p> \
<p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 10:57:57.542 UTC \
[4432] LOG:&nbsp; logical replication table synchronization worker for subscription \
&quot;sub_gwn1&quot;, table &quot;p&quot; has finished<o:p></o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 \
11:00:03.806 UTC [4431] LOG:&nbsp; logical replication table synchronization worker \
for subscription &quot;sub_gwn1&quot;, table &quot;p1&quot; has \
finished<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Doing it \
for three tables took 46 minutes<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 11:49:11.931 UTC \
[4739] LOG:&nbsp; logical replication table synchronization worker for subscription \
&quot;sub_gwn1&quot;, table &quot;p2&quot; has started<o:p></o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 \
11:49:11.948 UTC [4740] LOG:&nbsp; logical replication table synchronization worker \
for subscription &quot;sub_gwn1&quot;, table &quot;p1&quot; has \
started<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 12:23:44.673 UTC \
[4740] LOG:&nbsp; logical replication table synchronization worker for subscription \
&quot;sub_gwn1&quot;, table &quot;p1&quot; has finished<o:p></o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 \
12:23:44.783 UTC [4845] LOG:&nbsp; logical replication table synchronization worker \
for subscription &quot;sub_gwn1&quot;, table &quot;p&quot; has started<o:p></o:p></p> \
<p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 12:28:53.320 UTC \
[4739] LOG:&nbsp; logical replication table synchronization worker for subscription \
&quot;sub_gwn1&quot;, table &quot;p2&quot; has finished<o:p></o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">2021-12-27 \
12:35:49.156 UTC [4845] LOG:&nbsp; logical replication table synchronization worker \
for subscription &quot;sub_gwn1&quot;, table &quot;p&quot; has \
finished<o:p></o:p></p> <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> <p \
class="MsoNormal" style="text-align:left;direction:ltr;unicode-bidi:embed">Thanks!<o:p></o:p></p>
 <p class="MsoNormal" \
style="text-align:left;direction:ltr;unicode-bidi:embed"><o:p>&nbsp;</o:p></p> </div>
IMPORTANT - This email and any attachments is intended for the above named \
addressee(s), and may contain information which is confidential or privileged. If you \
are not the intended recipient, please inform the sender immediately and delete this \
email: you  should not copy or use this e-mail for any purpose nor disclose its \
contents to any person. </body>
</html>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic