Logical replication and truncate table

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Logical replication and truncate table

Yambu
Hello

Please confirm this , truncate a table on master db does not work well wilth logical replication?
It results in duplicate key errors on slave right?

We should rather use delete from table?
Reply | Threaded
Open this post in threaded view
|

Re: Logical replication and truncate table

Jerry Sievers-3
Yambu <[hidden email]> writes:

> Hello
>
> Please confirm this , truncate a table on master db does not work
> well wilth logical replication?
> It results in duplicate key errors on slave right?

Trunc has been supported in native logical replication since V11.

Start by telling us what Pg version you're on and what logical
replication your using.

See the docs.
>
> We should rather use delete from table?
>
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Logical replication and truncate table

Yambu
Hi

We are using Pg V10 , streaming , async 

On Wed, Dec 23, 2020 at 7:04 PM Jerry Sievers <[hidden email]> wrote:
Yambu <[hidden email]> writes:

> Hello
>
> Please confirm this , truncate a table on master db does not work
> well wilth logical replication?
> It results in duplicate key errors on slave right?

Trunc has been supported in native logical replication since V11.

Start by telling us what Pg version you're on and what logical
replication your using.

See the docs.
>
> We should rather use delete from table?
>
>

--
Jerry Sievers
Postgres DBA/Development Consulting
e: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: Logical replication and truncate table

hubert depesz lubaczewski-2
On Thu, Dec 24, 2020 at 09:24:15AM +0200, Yambu wrote:
> Hi
> We are using Pg V10 , streaming , async 

So yeah - delete is your friend for now. But you should consider
upgrading. There are MANY new features since v10:
https://why-upgrade.depesz.com/show?from=10&to=13.1

Best regards,

depesz