Skip to content

Commit e370453

Browse files
committed
Add information around publication creation for postgres and its
impications on billing
1 parent 5595db6 commit e370453

File tree

9 files changed

+209
-8
lines changed

9 files changed

+209
-8
lines changed

docs/integrations/data-ingestion/clickpipes/postgres/source/aurora.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ Connect to your Aurora PostgreSQL writer instance as an admin user and execute t
8989
4. Create a publication for replication:
9090

9191
```sql
92-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
92+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
9393
```
9494

95+
:::note
96+
97+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
98+
99+
:::
100+
95101
## Configure network access {#configure-network-access}
96102

97103
### IP-based access control {#ip-based-access-control}

docs/integrations/data-ingestion/clickpipes/postgres/source/azure-flexible-server-postgres.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ Connect to your Azure Flexible Server Postgres through the admin user and run th
5858
4. Create publication that you'll be using for creating the MIRROR (replication) in future.
5959

6060
```sql
61-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
61+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
6262
```
6363

64+
:::note
65+
66+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
67+
68+
:::
69+
6470
5. Set `wal_sender_timeout` to 0 for `clickpipes_user`
6571

6672
```sql

docs/integrations/data-ingestion/clickpipes/postgres/source/crunchy-postgres.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,15 @@ Connect to your Crunchy Bridge Postgres through the `postgres` user and run the
5050
4. Create publication that you'll be using for creating the MIRROR (replication) in future.
5151
5252
```sql
53-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
53+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
5454
```
5555
56+
:::note
57+
58+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
59+
60+
:::
61+
5662
## Safe list ClickPipes IPs {#safe-list-clickpipes-ips}
5763
5864
Safelist [ClickPipes IPs](../../index.md#list-of-static-ips) by adding the Firewall Rules in Crunchy Bridge.

docs/integrations/data-ingestion/clickpipes/postgres/source/generic.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,14 @@ For this, you can connect to your Postgres instance and run the following SQL co
6666
ALTER USER clickpipes_user REPLICATION;
6767
6868
-- Create a publication. We will use this when creating the pipe
69-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
69+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
7070
```
7171
:::note
7272

7373
Make sure to replace `clickpipes_user` and `clickpipes_password` with your desired username and password.
7474

75+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
76+
7577
:::
7678

7779
## Enabling connections in pg_hba.conf to the ClickPipes User {#enabling-connections-in-pg_hbaconf-to-the-clickpipes-user}

docs/integrations/data-ingestion/clickpipes/postgres/source/google-cloudsql.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,15 @@ Connect to your Cloud SQL Postgres through the admin user and run the below comm
6868
4. Create publication that you'll be using for creating the MIRROR (replication) in future.
6969

7070
```sql
71-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
71+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
7272
```
7373

74+
:::note
75+
76+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
77+
78+
:::
79+
7480
[//]: # (TODO Add SSH Tunneling)
7581

7682
## Add ClickPipes IPs to Firewall {#add-clickpipes-ips-to-firewall}

docs/integrations/data-ingestion/clickpipes/postgres/source/neon-postgres.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,17 @@ Here, we can run the following SQL commands:
3535
ALTER USER clickpipes_user REPLICATION;
3636

3737
-- Create a publication. We will use this when creating the mirror
38-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
38+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
3939
```
4040

4141
<Image size="lg" img={neon_commands} alt="User and publication commands" border/>
4242

43+
:::note
44+
45+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
46+
47+
:::
48+
4349
Click on **Run** to have a publication and a user ready.
4450

4551
## Enable logical replication {#enable-logical-replication}
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
sidebar_label: 'Publication Management'
3+
description: 'Best practices for managing PostgreSQL publications with ClickPipes'
4+
slug: /integrations/clickpipes/postgres/source/publication-management
5+
title: 'PostgreSQL Publication Management for ClickPipes'
6+
---
7+
8+
# PostgreSQL Publication Management for ClickPipes
9+
10+
This guide covers best practices and considerations for managing PostgreSQL publications when using ClickPipes for data replication.
11+
12+
## Publication Creation Options {#publication-creation-options}
13+
14+
You have two main approaches for managing publications with ClickPipes:
15+
16+
### Option 1: Automatic Publication Creation (Recommended for Simplicity) {#automatic-publication-creation}
17+
18+
If you **don't specify a publication** during ClickPipe creation, ClickPipes will automatically create a publication scoped to only the tables you select for replication.
19+
20+
**Requirements:**
21+
- The ClickPipes user must have **table owner permissions** for all tables you want to replicate
22+
- This is the easiest approach for getting started
23+
24+
**Advantages:**
25+
- No manual publication management required
26+
- Publication is automatically scoped to only selected tables
27+
- No risk of billing for unwanted table data
28+
29+
**Disadvantages:**
30+
- Requires higher privileges (table owner permissions)
31+
- If you add tables to the pipe later, ClickPipes will need to modify the publication, requiring continued owner permissions
32+
33+
### Option 2: Manual Publication Creation (Recommended for Production) {#manual-publication-creation}
34+
35+
Create and manage the publication yourself before setting up the ClickPipe.
36+
37+
#### Table-Specific Publication (Recommended) {#table-specific-publication}
38+
39+
```sql
40+
-- Create a publication for specific tables you wish to replicate
41+
-- Replace 'schema.table1', 'schema.table2' with your actual schema and table names
42+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
43+
```
44+
45+
**Advantages:**
46+
- Fine-grained control over which tables are included
47+
- Only requires SELECT permissions on tables (not ownership)
48+
- Clear visibility into what data will be replicated
49+
- Optimal billing - only pay for data you actually need
50+
51+
**Disadvantages:**
52+
- Manual management required
53+
- Must update publication when adding/removing tables from replication
54+
55+
#### All-Tables Publication (Use with Caution) {#all-tables-publication}
56+
57+
```sql
58+
-- Creates publication for all current and future tables
59+
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
60+
```
61+
62+
**Important Considerations:**
63+
- Though ClickPipes will only replicate tables you select in the UI, PostgreSQL will send data changes from **all tables** over the network
64+
- **You will be billed for the extra bytes** from tables you don't actually need
65+
- This approach is generally not recommended for production use
66+
67+
## Permission Requirements {#permission-requirements}
68+
69+
### For Automatic Publication Creation {#automatic-permissions}
70+
```sql
71+
-- Grant table ownership (required for automatic publication creation)
72+
ALTER TABLE schema.table1 OWNER TO clickpipes_user;
73+
ALTER TABLE schema.table2 OWNER TO clickpipes_user;
74+
```
75+
76+
### For Manual Publication Creation {#manual-permissions}
77+
```sql
78+
-- Minimal permissions (sufficient for manual publication approach)
79+
GRANT USAGE ON SCHEMA "your_schema" TO clickpipes_user;
80+
GRANT SELECT ON TABLE schema.table1, schema.table2 TO clickpipes_user;
81+
ALTER USER clickpipes_user REPLICATION;
82+
83+
-- If you need to grant permissions for future tables in the schema:
84+
ALTER DEFAULT PRIVILEGES IN SCHEMA "your_schema" GRANT SELECT ON TABLES TO clickpipes_user;
85+
```
86+
87+
## Managing Publications Over Time {#managing-publications-over-time}
88+
89+
### Adding Tables to an Existing Publication {#adding-tables}
90+
91+
If you need to add tables to your ClickPipe later:
92+
93+
```sql
94+
-- Add a single table
95+
ALTER PUBLICATION clickpipes_publication ADD TABLE schema.new_table;
96+
97+
-- Add multiple tables
98+
ALTER PUBLICATION clickpipes_publication ADD TABLE schema.table3, schema.table4;
99+
```
100+
101+
### Removing Tables from a Publication {#removing-tables}
102+
103+
```sql
104+
-- Remove a single table
105+
ALTER PUBLICATION clickpipes_publication DROP TABLE schema.old_table;
106+
107+
-- Remove multiple tables
108+
ALTER PUBLICATION clickpipes_publication DROP TABLE schema.table3, schema.table4;
109+
```
110+
111+
### Viewing Publication Contents {#viewing-publication-contents}
112+
113+
```sql
114+
-- See which tables are in your publication
115+
SELECT schemaname, tablename
116+
FROM pg_publication_tables
117+
WHERE pubname = 'clickpipes_publication';
118+
119+
-- See all publications
120+
SELECT * FROM pg_publication;
121+
```
122+
123+
## Best Practices {#best-practices}
124+
125+
1. **Start with table-specific publications** for production workloads to maintain cost control and clarity
126+
127+
2. **Use automatic creation for development/testing** when you want to get started quickly and don't mind granting higher privileges
128+
129+
3. **Plan your table selection carefully** - adding/removing tables later requires publication changes
130+
131+
4. **Monitor your data usage** to ensure you're only paying for data you actually need
132+
133+
5. **Document your publication strategy** so team members understand the setup
134+
135+
## Billing Implications {#billing-implications}
136+
137+
- **Table-specific publications**: You pay only for data changes from explicitly listed tables
138+
- **All-tables publications**: You pay for data changes from all tables in the database, even if ClickPipes only processes a subset
139+
- **Automatic creation**: You pay only for data from selected tables (most cost-effective)
140+
141+
## Additional Resources {#additional-resources}
142+
143+
For more advanced publication options and syntax, see the [PostgreSQL documentation](https://www.postgresql.org/docs/current/sql-createpublication.html).
144+
145+
## Troubleshooting {#troubleshooting}
146+
147+
### Permission Errors {#permission-errors}
148+
If you encounter permission errors:
149+
1. Verify the ClickPipes user has the required permissions for your chosen approach
150+
2. Check that the publication exists and contains the expected tables
151+
3. Ensure the user has REPLICATION privileges
152+
153+
### Unexpected Billing {#unexpected-billing}
154+
If you're seeing higher than expected data transfer costs:
155+
1. Check if you're using an all-tables publication unintentionally
156+
2. Verify your publication only contains the tables you need
157+
3. Monitor which tables are actively changing in your database

docs/integrations/data-ingestion/clickpipes/postgres/source/rds.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,15 @@ Connect to your RDS Postgres instance as an admin user and execute the following
8989
4. Create a publication for replication:
9090

9191
```sql
92-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
92+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
9393
```
9494

95+
:::note
96+
97+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
98+
99+
:::
100+
95101
## Configure network access {#configure-network-access}
96102

97103
### IP-based access control {#ip-based-access-control}

docs/integrations/data-ingestion/clickpipes/postgres/source/supabase.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ Here, we can run the following SQL commands:
3636
ALTER USER clickpipes_user REPLICATION;
3737

3838
-- Create a publication. We will use this when creating the mirror
39-
CREATE PUBLICATION clickpipes_publication FOR ALL TABLES;
39+
CREATE PUBLICATION clickpipes_publication FOR TABLE schema.table1, schema.table2;
4040
```
4141

4242
<Image img={supabase_commands} alt="User and publication commands" size="large" border/>
4343

44+
:::note
45+
46+
For detailed information about publication management, including automatic creation, table-specific vs all-tables publications, and billing implications, see our [Publication Management Guide](./publication-management.md).
47+
48+
:::
49+
4450
Click on **Run** to have a publication and a user ready.
4551

4652
:::note

0 commit comments

Comments
 (0)