Created
July 25, 2024 13:29
-
-
Save CHERTS/f9c7c88d5abaaf85300fd9776fcb3b00 to your computer and use it in GitHub Desktop.
Checking capturing data change use logical slot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create slot | |
SELECT pg_create_logical_replication_slot('test_slot_v1', 'pgoutput'); | |
-- Show publication name | |
SELECT pubname FROM pg_publication_tables GROUP BY pubname; | |
-- Peak changes (does not consume changes) | |
SELECT pg_logical_slot_peek_binary_changes('test_slot_v1', NULL, NULL, 'publication_names', 'dbz_publication', 'proto_version', '1'); | |
-- Get changes (consumes changes) | |
SELECT pg_logical_slot_get_binary_changes('test_slot_v1', NULL, NULL, 'publication_names', 'dbz_publication', 'proto_version', '1'); | |
-- Drop slot | |
SELECT pg_drop_replication_slot ('test_slot_v1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment