public inbox for [email protected]  
help / color / mirror / Atom feed
pg 16.4, logical replication, use case = data archiving
2+ messages / 1 participants
[nested] [flat]

* pg 16.4, logical replication, use case = data archiving
@ 2024-08-20 00:26  milist ujang <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: milist ujang @ 2024-08-20 00:26 UTC (permalink / raw)
  To: pgsql-general

Hi all,

I Play logical replication with row filter feature, my use case is data
archiving.
in lab env, it worked, my questions:
- during alter subscription, what about on-going DML? Can it be lost?
- any lock during alter subscription should I aware?


scenario:

# on source

tutorial=# ALTER PUBLICATION pub1 set TABLE users,likes,articles WHERE
(title <> 'del');

ALTER PUBLICATION

tutorial=# \dRp+

                              Publication pub1

  Owner   | All tables | Inserts | Updates | Deletes | Truncates | Via root

----------+------------+---------+---------+---------+-----------+----------

 postgres | f          | t       | t       | t       | t         | f

Tables:

    "public.articles" WHERE (title <> 'del'::text)

    "public.likes"

    "public.users"

wait a moment....

update users set password_digest='del' where id=10;

wait a moment...

tutorial=# ALTER PUBLICATION pub1 set TABLE users WHERE (password_digest <>
'del'),likes,articles WHERE (title <> 'del');

ALTER PUBLICATION

tutorial=# \dRp+

                              Publication pub1

  Owner   | All tables | Inserts | Updates | Deletes | Truncates | Via root

----------+------------+---------+---------+---------+-----------+----------

 postgres | f          | t       | t       | t       | t         | f

Tables:

    "public.articles" WHERE (title <> 'del'::text)

    "public.likes"

    "public.users" WHERE (password_digest <> 'del'::text)


delete from users where id=10;

# source and target

select * from users;

id=10 gone at source, but exist at target



-- 
regards

ujang jaenudin | Self-Employed, DBA Consultant
http://id.linkedin.com/pub/ujang-jaenudin/12/64/bab


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: pg 16.4, logical replication, use case = data archiving
@ 2024-08-20 00:41  milist ujang <[email protected]>
  parent: milist ujang <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: milist ujang @ 2024-08-20 00:41 UTC (permalink / raw)
  To: pgsql-general

My experience with oracle streams (upto version 12.1).
there is a tag at capture, by default tag is null (if not defined).

at the session level we set DBMS_STREAMS.SET_TAG ; so whatever this session
does, will not replicate.
Maybe this kind of "tag" is planned in the upcoming logical replication
feature ?




On Tue, Aug 20, 2024 at 7:26 AM milist ujang <[email protected]> wrote:

> Hi all,
>
> I Play logical replication with row filter feature, my use case is data
> archiving.
> in lab env, it worked, my questions:
> - during alter subscription, what about on-going DML? Can it be lost?
> - any lock during alter subscription should I aware?
>
>
> scenario:
>
> # on source
>
> tutorial=# ALTER PUBLICATION pub1 set TABLE users,likes,articles WHERE
> (title <> 'del');
>
> ALTER PUBLICATION
>
> tutorial=# \dRp+
>
>                               Publication pub1
>
>   Owner   | All tables | Inserts | Updates | Deletes | Truncates | Via root
>
>
> ----------+------------+---------+---------+---------+-----------+----------
>
>  postgres | f          | t       | t       | t       | t         | f
>
> Tables:
>
>     "public.articles" WHERE (title <> 'del'::text)
>
>     "public.likes"
>
>     "public.users"
>
> wait a moment....
>
> update users set password_digest='del' where id=10;
>
> wait a moment...
>
> tutorial=# ALTER PUBLICATION pub1 set TABLE users WHERE (password_digest
> <> 'del'),likes,articles WHERE (title <> 'del');
>
> ALTER PUBLICATION
>
> tutorial=# \dRp+
>
>                               Publication pub1
>
>   Owner   | All tables | Inserts | Updates | Deletes | Truncates | Via root
>
>
> ----------+------------+---------+---------+---------+-----------+----------
>
>  postgres | f          | t       | t       | t       | t         | f
>
> Tables:
>
>     "public.articles" WHERE (title <> 'del'::text)
>
>     "public.likes"
>
>     "public.users" WHERE (password_digest <> 'del'::text)
>
>
> delete from users where id=10;
>
> # source and target
>
> select * from users;
>
> id=10 gone at source, but exist at target
>
>
>
> --
> regards
>
> ujang jaenudin | Self-Employed, DBA Consultant
> http://id.linkedin.com/pub/ujang-jaenudin/12/64/bab
>


-- 
regards

ujang jaenudin | Self-Employed, DBA Consultant
http://id.linkedin.com/pub/ujang-jaenudin/12/64/bab


^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2024-08-20 00:41 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-08-20 00:26 pg 16.4, logical replication, use case = data archiving milist ujang <[email protected]>
2024-08-20 00:41 ` milist ujang <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox