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
SELECT DISTINCT | |
CASE | |
WHEN b.sender=0 AND c.receiver=0 THEN | |
'standalone' | |
WHEN b.sender>0 AND c.receiver=0 THEN | |
'primary' | |
WHEN b.sender=0 AND c.receiver>0 THEN | |
'replica' | |
WHEN b.sender>0 AND c.receiver>0 THEN | |
'primary+replica' |
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
wget -qO - $(OS=$(uname -s | tr '[:upper:]' '[:lower:]'); ARCH=$(uname -p | sed 's/x86_64/amd64/g'); wget https://api.github.com/repos/CHERTS/pgscv/releases/latest -qO - | grep -wo "https.*${OS}_${ARCH}.tar.g | |
z") | tar xzf - -C /tmp && \ | |
mv /tmp/pgscv.yaml /etc 2>/dev/null && \ | |
mv /tmp/pgscv.service /etc/systemd/system 2>/dev/null && \ | |
mv /tmp/pgscv.default /etc/default/pgscv 2>/dev/null && \ | |
mv /tmp/pgscv /usr/sbin 2>/dev/null && \ | |
chown postgres:postgres /etc/pgscv.yaml 2>/dev/null && \ | |
systemctl daemon-reload && \ | |
systemctl enable pgscv --now |
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
services: | |
redpanda: | |
image: docker.redpanda.com/redpandadata/redpanda:v24.2.5 | |
container_name: redpanda | |
command: | |
- redpanda | |
- start | |
- --kafka-addr internal://0.0.0.0:9092,external://0.0.0.0:19092 | |
# Address the broker advertises to clients that connect to the Kafka API. | |
# Use the internal addresses to connect to the Redpanda brokers' |
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
DO $$ | |
DECLARE | |
sch RECORD; | |
tab RECORD; | |
seq RECORD; | |
viw RECORD; | |
mat RECORD; | |
fun RECORD; | |
ctype RECORD; | |
v_schema_exclude text[] := '{pg_catalog,information_schema,monitor,repack}'; |
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
#!/bin/bash | |
# ps aux written entirely in bash without ever forking | |
# Author: Isabella Bosia | |
# Github: https://github.com/izabera/ps/tree/develop | |
# | |
# so initially i was hoping you could get everything from /proc/<pid>/status | |
# because it's easy to parse (in most cases) but apparently you can't get | |
# things like the cpu% :( |
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 publication | |
CREATE PUBLICATION cdc; | |
-- Create slot | |
SELECT pg_create_logical_replication_slot('test_slot_v1', 'pgoutput'); | |
-- Create example table | |
CREATE TABLE replication_test_v1 | |
( | |
id integer NOT NULL PRIMARY KEY, |
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) |
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 TABLE IF NOT EXISTS orders_with_partitions ( | |
id uuid not null, | |
processed_at timestamp with time zone not null, | |
created_at timestamp with time zone not null default CURRENT_TIMESTAMP, | |
data jsonb not null | |
) PARTITION BY RANGE (created_at); | |
CREATE INDEX IF NOT EXISTS orders_with_partitions_created_at_idx | |
ON orders_with_partitions (created_at); |
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 TYPE products_unit AS ENUM ('Килограмм', 'Грамм', 'Литр', 'Метр', 'Пара', 'Штука'); | |
CREATE TABLE IF NOT EXISTS products ( | |
product_no bigint PRIMARY KEY, | |
price numeric, | |
unit products_unit, | |
active bool, | |
name text | |
); |
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 SCHEMA debezium; | |
CREATE TABLE debezium.debezium_signal(id VARCHAR(42) PRIMARY KEY, type VARCHAR(32) NOT NULL, data VARCHAR(2048) NULL); | |
CREATE TABLE debezium.pg_heartbeat(id SERIAL, last_update TIMESTAMP DEFAULT current_timestamp, PRIMARY KEY (id)); | |
--INSERT INTO debezium.pg_heartbeat(id) VALUES (0); | |
GRANT USAGE ON SCHEMA debezium TO debezium_dwh; | |
GRANT SELECT, INSERT, UPDATE, DELETE ON debezium.debezium_signal TO debezium_dwh; | |
GRANT SELECT, INSERT, UPDATE, DELETE ON debezium.pg_heartbeat TO debezium_dwh; | |
ALTER PUBLICATION dbz_publication ADD TABLE debezium.debezium_signal; | |
ALTER PUBLICATION dbz_publication ADD TABLE debezium.pg_heartbeat; | |
ALTER TABLE debezium.debezium_signal REPLICA IDENTITY FULL; |
NewerOlder