Stay organized with collections
Save and categorize content based on your preferences.
This section contains information about:
The behavior of how Datastream handles data that's being pulled from a source PostgreSQL database
The versions of PostgreSQL database that Datastream supports
An overview of how to setup a source PostgreSQL database so that data can be streamed from it to a destination
Known limitations for using PostgreSQL database as a source
Behavior
The source PostgreSQL database relies upon its logical decoding feature. Logical decoding exposes all changes committed to the database and allows consuming and processing these changes in a user-friendly format using an output plugin. Datastream uses the pgoutput plugin, which is the standard PostgreSQL logical decoding plugin for PostgreSQL 10 and later.
All schemas or specific schemas from a given PostgreSQL source, as well as all tables from the schema or specific tables, can be selected.
All historical data is replicated.
All data manipulation language (DML) changes, such as inserts, updates, and deletes from the specified databases and tables, are replicated.
Only committed changes are replicated.
If you define a REPLICA IDENTITY on a table, Datastream treats the specified columns as primary keys.
Versions
Datastream supports PostgreSQL version 10 and later.
Datastream supports the following types of PostgreSQL database:
Self-hosted PostgreSQL
Cloud SQL for PostgreSQL
AlloyDB for PostgreSQL
AlloyDB Omni
Amazon RDS for PostgreSQL
Amazon Aurora PostgreSQL
Known limitations
Known limitations for using Datastream with a PostgreSQL database as a source include:
Streams are limited to 10,000 tables.
A table that has more than 500 million rows can't be backfilled unless the following conditions are met:
The table has a unique B-tree index.
The index doesn't include columns of the following types:
DOUBLE, FLOAT, MONEY, REAL, JSON, JSONB, BYTEA, TXID, XML,
composite data types
or geometric data types.
None of the columns of the index are nullable.
All columns of the index are in ascending order, or all columns of the index are in descending order.
All columns of the index are included in the stream.
Tables without primary keys must have a REPLICA IDENTITY. Otherwise, only INSERT events are replicated to the destination.
Tables with primary keys can't have the REPLICA IDENTITY set to FULL or NOTHING. It has to be set to DEFAULT.
Datastream can't replicate from a read replica instance, because PostgreSQL doesn't support logical decoding in read replicas.
Not all changes to the source schema can be detected automatically, in which case data corruption may occur. The following schema changes may cause data corruption or failure to process the events downstream:
Dropping columns.
Adding columns to the middle of a table.
Changing the data type of a column.
Reordering columns.
Dropping tables (relevant if the same table is then recreated with new data added).
Datastream doesn't support columns of the geometric data types.
Datastream doesn't support columns of the range data types.
Datastream doesn't support arrays of unsupported data types, arrays of user-defined data types (including ENUM) or arrays of DATE, TIMESTAMP or TIMESTAMP WITH TIME ZONE data types. Such columns are ignored.
Datastream doesn't support replicating UPDATE events for rows which include TOAST values in columns that are part of the table's replica identity. Such events are discarded.
Datastream doesn't support replicating rows which include JSON or JSONB values with more than 2950 nested objects. Events containing such JSON or JSONB values aren't replicated to the destination database.
Datastream doesn't support replicating rows which include NaN values in NUMERIC (precision, scale) columns. The values in such columns are replaced with NULL values.
Datastream doesn't support replicating columns of the hstore data type. The values in such columns are replaced with NULL values.
Datastream doesn't support replicating non-ASCII records from a SQL_ASCII encoded source database. Such records are discarded.
Datastream doesn't support replicating tables with Row-Level Security (RLS) policies defined.
For information about how to bypass this limitation, see PostgreSQL source behavior and limitations.
Datastream might stop working or not capture any new events when a PostgreSQL major version upgrade is performed on the database. We suggest you to drop the replication slots before the upgrade, then upgrade the database, and then recreate the replication slots. If the streams fail, recover the stream by specifying the new replication slot name, and perform a backfill if data consistency is required.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003eDatastream uses PostgreSQL's logical decoding feature and the \u003ccode\u003epgoutput\u003c/code\u003e plugin to replicate committed data changes, including historical data and DML operations like inserts, updates, and deletes, from the source database.\u003c/p\u003e\n"],["\u003cp\u003eDatastream supports PostgreSQL version 10 and later, along with various PostgreSQL database types such as self-hosted, Cloud SQL, AlloyDB, Amazon RDS, and Amazon Aurora.\u003c/p\u003e\n"],["\u003cp\u003eThere is a limitation of 10,000 tables per stream, and tables with over 500 million rows have specific backfill requirements, such as having a unique B-tree index with non-nullable columns.\u003c/p\u003e\n"],["\u003cp\u003eTables without primary keys must have a \u003ccode\u003eREPLICA IDENTITY\u003c/code\u003e defined; otherwise, only \u003ccode\u003eINSERT\u003c/code\u003e events are replicated, and Datastream cannot replicate from a read replica instance.\u003c/p\u003e\n"],["\u003cp\u003eSpecific schema changes like dropping columns or changing data types, as well as unsupported data types like geometric or range data types, can cause data corruption or failure, and certain data like \u003ccode\u003eJSON\u003c/code\u003e or \u003ccode\u003eJSONB\u003c/code\u003e values with excessive nesting also have replication limitations.\u003c/p\u003e\n"]]],[],null,["# Source PostgreSQL database\n\nThis section contains information about:\n\n- The behavior of how Datastream handles data that's being pulled from a source PostgreSQL database\n- The versions of PostgreSQL database that Datastream supports\n- An overview of how to setup a source PostgreSQL database so that data can be streamed from it to a destination\n- Known limitations for using PostgreSQL database as a source\n\nBehavior\n--------\n\nThe source PostgreSQL database relies upon its [logical decoding](https://www.postgresql.org/docs/current/logicaldecoding-explanation.html) feature. Logical decoding exposes all changes committed to the database and allows consuming and processing these changes in a user-friendly format using an output plugin. Datastream uses the `pgoutput` plugin, which is the standard PostgreSQL logical decoding plugin for PostgreSQL 10 and later.\n\n- All schemas or specific schemas from a given PostgreSQL source, as well as all tables from the schema or specific tables, can be selected.\n- All historical data is replicated.\n- All data manipulation language (DML) changes, such as inserts, updates, and deletes from the specified databases and tables, are replicated.\n- Only committed changes are replicated.\n- If you define a [REPLICA IDENTITY](https://www.postgresql.org/docs/current/sql-altertable.html#SQL-ALTERTABLE-REPLICA-IDENTITY) on a table, Datastream treats the specified columns as primary keys.\n\nVersions\n--------\n\nDatastream supports PostgreSQL version 10 and later.\n\nDatastream supports the following types of PostgreSQL database:\n\n- Self-hosted PostgreSQL\n- Cloud SQL for PostgreSQL\n- AlloyDB for PostgreSQL\n- AlloyDB Omni\n- Amazon RDS for PostgreSQL\n- Amazon Aurora PostgreSQL\n\nKnown limitations\n-----------------\n\n| **Note:** This section describes limitations for using Datastream with a PostgreSQL database as a source. In addition to these limitations, you need to familiarize yourself with PostgreSQL logical replication limitations, because they also affect how Datastream streams data from a PostgreSQL source. To learn about limitations of PostgreSQL logical replication, see [logical replication restrictions](https://www.postgresql.org/docs/10/logical-replication-restrictions.html).\n\nKnown limitations for using Datastream with a PostgreSQL database as a source include:\n\n- Streams are limited to 10,000 tables.\n- A table that has more than 500 million rows can't be backfilled unless the following conditions are met:\n 1. The table has a unique B-tree index.\n 2. The index doesn't include columns of the following types: `DOUBLE`, `FLOAT`, `MONEY`, `REAL`, `JSON`, `JSONB`, `BYTEA`, `TXID`, `XML`, [composite data types](https://www.postgresql.org/docs/current/rowtypes.html#ROWTYPES) or [geometric data types](https://www.postgresql.org/docs/current/datatype-geometric.html).\n 3. None of the columns of the index are nullable.\n 4. All columns of the index are in ascending order, or all columns of the index are in descending order.\n 5. All columns of the index are included in the stream.\n- Tables without primary keys must have a [REPLICA IDENTITY](https://www.postgresql.org/docs/current/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY). Otherwise, only `INSERT` events are replicated to the destination.\n- Tables with primary keys can't have the [REPLICA IDENTITY](https://www.postgresql.org/docs/current/sql-altertable.html#SQL-CREATETABLE-REPLICA-IDENTITY) set to `FULL` or `NOTHING`. It has to be set to `DEFAULT`.\n- Datastream can't replicate from a read replica instance, because PostgreSQL doesn't support logical decoding in read replicas.\n- Not all changes to the source schema can be detected automatically, in which case data corruption may occur. The following schema changes may cause data corruption or failure to process the events downstream:\n - Dropping columns.\n - Adding columns to the middle of a table.\n - Changing the data type of a column.\n - Reordering columns.\n - Dropping tables (relevant if the same table is then recreated with new data added).\n- Datastream doesn't support columns of the [`geometric`](https://www.postgresql.org/docs/current/datatype-geometric.html) data types.\n- Datastream doesn't support columns of the [`range`](https://www.postgresql.org/docs/current/rangetypes.html) data types.\n- Datastream doesn't support arrays of unsupported data types, arrays of [user-defined](https://www.postgresql.org/docs/15/xtypes.html) data types (including `ENUM`) or arrays of `DATE`, `TIMESTAMP` or `TIMESTAMP WITH TIME ZONE` data types. Such columns are ignored.\n- Datastream doesn't support replicating `UPDATE` events for rows which include [`TOAST`](https://www.postgresql.org/docs/current/storage-toast.html) values in columns that are part of the table's replica identity. Such events are discarded.\n- Datastream doesn't support replicating rows which include `JSON` or `JSONB` values with more than 2950 nested objects. Events containing such `JSON` or `JSONB` values aren't replicated to the destination database.\n- Datastream doesn't support replicating rows which include `NaN` values in `NUMERIC (precision, scale)` columns. The values in such columns are replaced with `NULL` values.\n- Datastream doesn't support replicating columns of the [hstore](https://www.postgresql.org/docs/current/hstore.html) data type. The values in such columns are replaced with `NULL` values.\n- Datastream doesn't support replicating non-ASCII records from a SQL_ASCII encoded source database. Such records are discarded.\n- Datastream doesn't support replicating tables with Row-Level Security (RLS) policies defined. For information about how to bypass this limitation, see [PostgreSQL source behavior and limitations](/datastream/docs/faq#postgresql-source).\n- Datastream doesn't capture changes made to [generated columns](https://www.postgresql.org/docs/current/ddl-generated-columns.html).\n- Datastream might stop working or not capture any new events when a PostgreSQL major version upgrade is performed on the database. We suggest you to drop the replication slots before the upgrade, then upgrade the database, and then recreate the replication slots. If the streams fail, recover the stream by specifying the new replication slot name, and perform a backfill if data consistency is required.\n\nWhat's next\n-----------\n\n- Learn how to [configure a PostgreSQL source](/datastream/docs/configure-your-source-postgresql-database) for use with Datastream."]]