Stay organized with collections
Save and categorize content based on your preferences.
Datastream supports replicating partitioned tables for PostgreSQL source
databases. You can replicate the tables as a single root table or as separate
partitioned tables. If you want to replicate both the root table and the partitioned
tables, you must create two different streams, with two different publications.
Replicate as a single root table
To replicate partitioned tables using the schema of the root table, do the
following:
Use a publication with the publish_via_partition_root parameter set to true
or create a new one:
[[["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-29 UTC."],[[["\u003cp\u003eDatastream enables the replication of partitioned tables from PostgreSQL databases, offering the flexibility to replicate them as a unified root table or as individual, separate tables.\u003c/p\u003e\n"],["\u003cp\u003eTo replicate partitioned tables as a single root table, use a publication with the \u003ccode\u003epublish_via_partition_root\u003c/code\u003e parameter set to \u003ccode\u003etrue\u003c/code\u003e, and in stream creation select only the root table, excluding the partitioned tables.\u003c/p\u003e\n"],["\u003cp\u003eTo replicate partitioned tables as separate tables, utilize a publication with the \u003ccode\u003epublish_via_partition_root\u003c/code\u003e parameter set to \u003ccode\u003efalse\u003c/code\u003e, and during stream creation, choose only the partitioned tables, excluding the root table.\u003c/p\u003e\n"],["\u003cp\u003eChanging the \u003ccode\u003epublish_via_partition_root\u003c/code\u003e parameter in an existing stream is not allowed, causing permanent stream failure.\u003c/p\u003e\n"]]],[],null,["# Work with PostgreSQL partitioned tables\n\nDatastream supports replicating partitioned tables for PostgreSQL source\ndatabases. You can replicate the tables as a single root table or as separate\npartitioned tables. If you want to replicate both the root table and the partitioned\ntables, you must create two different streams, with two different publications.\n\nReplicate as a single root table\n--------------------------------\n\nTo replicate partitioned tables using the schema of the root table, do the\nfollowing:\n\n1. Use a publication with the `publish_via_partition_root` parameter set to `true`\n or create a new one:\n\n CREATE PUBLICATION \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003ePUBLICATION_NAME\u003c/span\u003e\u003c/var\u003e FOR TABLE\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSCHEMA1\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTABLE1\u003c/span\u003e\u003c/var\u003e, \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eSCHEMA2\u003c/span\u003e\u003cspan class=\"devsite-syntax-p\"\u003e.\u003c/span\u003e\u003cspan class=\"devsite-syntax-n\"\u003eTABLE2\u003c/span\u003e\u003c/var\u003e WITH (publish_via_partition_root = true);\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003ePUBLICATION_NAME\u003c/var\u003e: The name of the publication.\n - \u003cvar translate=\"no\"\u003eSCHEMA(n)\u003c/var\u003e: The name of the schema that contains the table.\n - \u003cvar translate=\"no\"\u003eTABLE(n)\u003c/var\u003e: The name of the table for which you create the publication.\n\n | **Note:** Changing the value of the `publish_via_partition_root` parameter in a publication that's already used in a stream isn't supported and causes the stream to fail permanently.\n\n For more information about creating a publication, see\n [Configure a source PostgreSQL database](/datastream/docs/configure-your-source-postgresql-database).\n2. Complete the following in the **Configure source** step when you create your\n stream in Google Cloud:\n\n 1. From the **Objects to include** list, select **Specific schemas and\n tables**.\n 2. Select only the root table and make sure that the partitioned tables aren't selected.\n\n For information about creating a stream, see [Create a stream](/datastream/docs/create-a-stream).\n\nReplicate as separate partitioned tables\n----------------------------------------\n\nTo replicate partitioned tables as separate tables, do the following:\n\n1. Use a publication with the `publish_via_partition_root` parameter set to\n `false` or create a new one. `false` is the default setting for the parameter.\n\n | **Note:** Changing the value of the `publish_via_partition_root` parameter in a publication that's already used in a stream isn't supported and causes the stream to fail permanently.\n\n For more information about creating a publication, see\n [Configure a source PostgreSQL database](/datastream/docs/configure-your-source-postgresql-database).\n2. When you create your stream in Google Cloud, in the **Configure source** step,\n do the following:\n\n 1. From the **Objects to include** list, select **Specific schemas and\n tables**.\n 2. Select all partitioned tables and make sure that the root table isn't selected.\n\n For information about creating a stream, see [Create a stream](/datastream/docs/create-a-stream).\n\nWhat's next\n-----------\n\n- Learn more about [PostgreSQL as a source](/datastream/docs/sources-postgresql).\n- Learn more about [configuring a source PostgreSQL database](/datastream/docs/configure-your-source-postgresql-database)."]]