Re: Need help debugging slow logical replication

2023-02-08 Thread sunyuc...@gmail.com
OK: so I think I've got some new insight by using test_decoding to peek into the changes being replicate, here is what i think is happening: - there is a background job generating a Huge transaction (10K changes) one after another that basically does DELETE on 1 table, INSERT on 1 table and UPDAT

Re: Need help debugging slow logical replication

2023-02-07 Thread sunyuc...@gmail.com
ccing the mailist again in case someone else would have a idea how to debug: Here is what I see in the pg_locks on subscribe at all time: As you can see, it mostly concern following 3 tables, accounts, ledger, pending_ledger_fees, which I have tried analyze, vacuum them etc, none of them helped m

Re: Need help debugging slow logical replication

2023-02-07 Thread sunyuc...@gmail.com
Hi Justin, thanks for the response! > REPLICA IDENTITY DEFAULT will only use primary keys, if the publisher > includes those tables, the subscriber when replaying the WAL will stop > throwing an error not knowing how to replay the UPDATE/DELETE. But I don't see any errors being thrown out

Re: Need help debugging slow logical replication

2023-02-07 Thread Justin
On Tue, Feb 7, 2023 at 8:07 PM sunyuc...@gmail.com wrote: > Hi Justin: > > - i checked that I have 2 tables using replication identity FULL, but > one table is empty and one table has only 1 row > - 7 tables using index > - overall I have ~100 tables in the publication: But I do find that > some

Re: Need help debugging slow logical replication

2023-02-07 Thread sunyuc...@gmail.com
Hi Justin: - i checked that I have 2 tables using replication identity FULL, but one table is empty and one table has only 1 row - 7 tables using index - overall I have ~100 tables in the publication: But I do find that some tables doesn't have PK , but using replica identity default, I'm abit co

Re: Need help debugging slow logical replication

2023-02-07 Thread Justin
On Tue, Feb 7, 2023 at 6:38 PM sunyuc...@gmail.com wrote: > Hi there, > > I am using PG 14.14 on both primary and secondary DB on AWS, setup > using a logical replication, I'm having trouble with huge replication > lag. > > My setup is as follows: > > P1 - physical - P1-R > | (logical) > P2 - p