Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Questa sezione contiene informazioni su:
Il comportamento di Datastream per la gestione dei dati estratti da un database PostgreSQL di origine
Le versioni del database PostgreSQL supportate da Datastream
Una panoramica su come configurare un database PostgreSQL di origine in modo che i dati possano essere trasmessi in streaming a una destinazione
Limitazioni note per l'utilizzo del database PostgreSQL come origine
Comportamento
Il database PostgreSQL di origine si basa sulla funzionalità di decodifica logica. La decodifica logica espone tutte le modifiche committate al database e consente di utilizzarle ed elaborarle in un formato intuitivo utilizzando un plug-in di output. Datastream utilizza il plug-in pgoutput, che è il plug-in di decodifica logica PostgreSQL standard per PostgreSQL 10 e versioni successive.
È possibile selezionare tutti gli schemi o schemi specifici di una determinata origine PostgreSQL, nonché tutte le tabelle dello schema o tabelle specifiche.
Tutti i dati storici vengono replicati.
Tutte le modifiche al data manipulation language (DML), come inserimenti, aggiornamenti ed eliminazioni dai database e dalle tabelle specificati, vengono replicate.
Vengono replicate solo le modifiche committate.
Se definisci un'IDENTITÀ REPLICA in una tabella, Datastream tratta le colonne specificate come chiavi primarie.
Versioni
Datastream supporta PostgreSQL versione 10 e successive.
Datastream supporta i seguenti tipi di database PostgreSQL:
PostgreSQL self-hosted
Cloud SQL per PostgreSQL
AlloyDB per PostgreSQL
AlloyDB Omni
Amazon RDS per PostgreSQL
Amazon Aurora PostgreSQL
Limitazioni note
Le limitazioni note per l'utilizzo di Datastream con un database PostgreSQL come origine includono:
Gli stream sono limitati a 10.000 tabelle.
Non è possibile eseguire il backfill di una tabella con più di 500 milioni di righe, a meno che non siano soddisfatte le seguenti condizioni:
Nessuna delle colonne dell'indice può ammettere valori nulli.
Tutte le colonne dell'indice sono in ordine crescente o tutte le colonne dell'indice sono in ordine decrescente.
Tutte le colonne dell'indice sono incluse nello stream.
Le tabelle senza chiavi primarie devono avere un attributo REPLICA IDENTITY. In caso contrario, solo gli eventi INSERT vengono replicati nella destinazione.
Le tabelle con chiavi primarie non possono avere IDENTITÀ REPLICA impostata su FULL o NOTHING. Deve essere impostato su DEFAULT.
Datastream non può eseguire la replica da un'istanza di replica di lettura perché PostgreSQL non supporta la decodifica logica nelle repliche di lettura.
Non tutte le modifiche allo schema di origine possono essere rilevate automaticamente, nel qual caso potrebbe verificarsi la corruzione dei dati. Le seguenti modifiche allo schema potrebbero causare la corruzione dei dati o l'elaborazione non corretta degli eventi a valle:
Eliminazione di colonne.
Aggiunta di colonne al centro di una tabella.
Modifica del tipo di dati di una colonna.
Riordinare le colonne.
Eliminazione di tabelle (rilevante se la stessa tabella viene poi ricreata con l'aggiunta di nuovi dati).
Datastream non supporta le colonne dei tipi di dati geometric.
Datastream non supporta le colonne dei tipi di dati range.
Datastream non supporta gli array di tipi di dati non supportati, gli array di tipi di dati definiti dall'utente (incluso ENUM) o gli array di tipi di dati DATE, TIMESTAMP o TIMESTAMP WITH TIME ZONE. Queste colonne vengono ignorate.
Datastream non supporta la replica degli eventi UPDATE per le righe che includono valori TOAST nelle colonne che fanno parte dell'identità della replica della tabella. Questi eventi vengono ignorati.
Datastream non supporta la replica delle righe che includono valori JSON o JSONB con più di 2950 oggetti nidificati. Gli eventi contenenti questi valori JSON o JSONB non vengono replicati nel database di destinazione.
Datastream non supporta la replica delle righe che includono valori NaN nelle colonne NUMERIC (precision, scale). I valori in queste colonne vengono sostituiti con valori NULL.
Datastream non supporta la replica delle colonne del tipo di dati hstore. I valori in queste colonne vengono sostituiti con valori NULL.
Datastream non supporta la replica di record non ASCII da un database di origine con codifica SQL_ASCII. Questi record vengono ignorati.
Datastream non supporta la replica delle tabelle con policy di sicurezza a livello di riga (RLS) definiti.
Per informazioni su come aggirare questa limitazione, consulta Comportamento e limitazioni dell'origine PostgreSQL.
Datastream non acquisisce le modifiche apportate alle colonne generate.
Datastream potrebbe smettere di funzionare o non acquisire nuovi eventi quando viene eseguito un upgrade della versione principale di PostgreSQL sul database. Ti consigliamo di eliminare gli slot di replica prima dell'upgrade, quindi di eseguire l'upgrade del database e di ricreare gli slot di replica. Se gli stream non vanno a buon fine, recupera lo stream specificando il nuovo nome dello slot di replica ed esegui un backfill se è richiesta la coerenza dei dati.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 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."]]